Forum Moderators: coopster
Thanks
You need to use explode() to seperate the data if thats what you are trying to achieve:
$aName = $_POST['aName'];
$data = explode(" ¦ ", $aName);
In your example, $data would hold values in two slots.
echo $data[0];
echo $data[1];
$data[0] would contain the value of $B and $data[1] would contain the value of $A.
You will need to lose the value part of your option field though, as this only contains $A.
print ("<option>$B ¦ $A </option>");
Hope that helps. or have I misunderstood you?
dc
Thanks,
For example, lets say your drop down menu shows the following:
print ("<option>Second Value ¦ First Value</option>");
If you echoed the value of $_POST['aName'] it would show:
Second Value ¦ First Value
The explode function splits the data based on a seperation point which you define. Here your data is split using ¦, so you would do:
$data = explode(" ¦ ", $_POST['aName']);
You now have two seperate values in the $data array.
$data[0] == "Second Value"
$data[1] == "First Value"
Use the $data variables to add the info wherever you want in your db.
INSERT INTO table (field1,field2) VALUES ('$data[0]','$data[1]');
Hope that made some sense.