Jump to content

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.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.