Jump to content

quickform - passing data from hierselect


idig

Recommended Posts

hi

appreciate any help.

i have a main array and a 2ndary array to select from. once i have selected for example uk from the main array and london from the 2ndary array, i submit and have a resultant array called for eg 'location' now this array when echo'd gives numbers and not the strings i.e uk and london. what do i need to do to get the strings out?

thanks
clive
Link to comment
Share on other sites

I am assuming you have something like...

$arr = array('London', 'Paris');

...

<select name="sel">
<option value="0">London</option>
<option value="1">Paris</option>
</select>

now there are two ways of doing this...

either change the html to this

<option value="London">London</option>
<option value="Paris">Paris</option>

or (and probably more useful!)

in the script accepting the data have your array(s) once more

$arr = array('London', 'Paris');

and then user $arr[$_POST['sel']]
Link to comment
Share on other sites

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.