PHP Comparing integers gives strange results -




i have following code:

$queueid = (int)$this->data["feedbackreview"]["queueid"]; echo $queueid . ' / ' . gettype($queueid); 

this gives:

24 / integer 

later in code similar this:

... <option value="24" <?php if ($queueid==24) {echo 'selected';} elseif ($feedback_action_queue==24) {echo 'selected';} else {};?>>tier 2 dm delivery team a</option> ... 

where $feedback_action_queue has been converted int - selected not being echo'd. why this? i've placed following before select tag, right before it:

var_dump($queueid, $feedback_action_queue) 

this gives:

int(24) int(0)

i've echo'd $queueid text of select , has brought 24

<option value="24" <?php if ($queueid==24) {echo 'selected';} elseif ($feedback_action_queue==24) {echo 'selected';} else { echo 'here';};?>>tier 2 dm delivery team <?php echo $queueid;?></option> 

this gives

<option value="24" here="">tier 2 dm delivery team 24</option> 

lastly

<option value="24" <?php echo $queueid;?> <?php if ($queueid == 24) {echo 'selected';} elseif ($feedback_action_queue == 24) {echo 'selected';} else { echo 'here';}?>>tier 2 dm delivery team <?php echo $queueid;?></option> 

gives following - it's being outputted @ end not @ start

<option value="24"  here>tier 2 dm delivery team 24</option> 

in summary

  • desired behavior: select option selected given relevant id
  • a specific problem or error: selected value not being displayed
  • shortest code necessary: please see above





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -