Hi I have a form page containing a select menu (id = "salary") whereby the user can select multiple values.
The form data is then posted to my 2nd page.
What I am trying to do is then get this posted salary data, if I was only sending one value across I would enter $salary = $_POST['salary'] however what is the terminology when posting multiple values?
Thanks in advance
[solved] Obtaining multiple values from a list menu
Moderator: General Moderators
You can send multiple data using POST or GET but you have to name your data differently ex data1, data2 i.e.
But try this code:
Code: Select all
$_POST['data1'] != $_POST['data2']Code: Select all
//your code
echo "<select>";
echo "<option value='2.php' select='selected'>Default value</option>";
echo "<option value='2.php?salary=1'>10000-20000</option>";
echo "<option value='2.php?salary=2'>21000-3000</option>";
echo "</select>"
//etc, etc, etc
//In the second page
if(is_numeric($_POST) && $_POST['salary']==2)
{
//your code for that case
}sorry i dont't think I explained that very well.....
what Iam trying to do is to send multiple values from ONE dropdown:
so this dropdown lets me select multiple values from it (not just the one)
What I am having trouble is assigning the multiple values on the 2nd page once it has been posted.
what Iam trying to do is to send multiple values from ONE dropdown:
Code: Select all
<select name="salary" size="5" multiple="multiple">
<option value="1">10,000</option>
<option value="2">20,000</option>
<option value="3">30,000</option>
</select>What I am having trouble is assigning the multiple values on the 2nd page once it has been posted.
try
Code: Select all
<select name="salary[]" size="5" multiple="multiple">