Jump to content

drop down get end of the array value.


swtlbee

Recommended Posts

I have a simple html drop down - example:

<select name="dd1[ ]" multiple size="3">

<option value="1">1</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

</select>

 

When I request the data I get my values 1 3 5 etc.

 

However I need to get the last value to use the following code:

foreach ($dd1 as $s) {

 

  if(!(end($ddl) == $s)){

  $thisvalue= " not at the end just yet  '" . $s . "'";

    }

      else{

    $thisvalue= " This is the last value selected '" . $s . "' ";

    }

      }

 

  echo ($whereFields);

 

Because I believe the Name of the drop down is dd1[ ] the array is always 0 or 1 never incrementing.

How can I get it to increment to get the last value in the array?

Link to comment
https://forums.phpfreaks.com/topic/190817-drop-down-get-end-of-the-array-value/
Share on other sites

I've tried count and I get 0123 etc. that does not seem to be working for me and if I could figure it out I wouldn't be asking for help. I do need help in trying to figure out how to assign values to my array in the drop down to get the end value.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.