Ok well here is the problem, i have a function call
Code<HR>
<?php Populatedrop("data","passengers","pass"); //***FUNCTION CALL. ?>
//This calls this function
<?php
//***FUNCTION TO POPULATE THE DROP FIELDS.
//***EXAMPLE CALL - populatedrop("Database Name", "Query Name", "Select Name");
//***AUTHOR - TONY
//***DATE - 16-08-2002
//***PRJ - Quote.php
function Populatedrop($db,$query,$dropname)
{
//***SETS THE COUNTER TO ZERO.
$counter = 0;
//***CONECTION.
$connection = odbc_connect("$db","","") or die("Couldn't connect to the database.");
//***DEFINE QUERY.
$query = "select * from $query";
//***EXECUTUE QUERY AND GET RESULTS.
$result = odbc_exec($connection, $query);
//***SETS THE HEADER FOR THE SELECT.
echo "<SELECT name=$dropname>\n";
echo " <OPTION value=0>Please Select</OPTION>\n";
echo " <OPTION value=0>---------------------------------------------------------</OPTION>\n";
//***LOOP THROUGH RESULTS
while(odbc_fetch_row($result))
{
//***ADDS ONE TO THE COUNTER EVERY LOOP.
$counter+=1;
//***SETS TO GET VALUES FROM THESE LOCATIONS.
$returnpoint= odbc_result($result, 2);
$value = odbc_result($result, 3);
$active = odbc_result($result, 4);
//***IF STATEMENT FOR ACTIVE VALIDATION.
if ($active=="0")
{
//***DO NOTHING
}
else
{
//***ADD A LINE TO CODE FOR EACH ITEM IN DROP BOX
echo " <OPTION VALUE=$returnpoint-$value>$returnpoint</OPTION>\n";
}
}
//***END OF THE LOOP TO GET DATA.
echo "</SELECT>";
//***CLOSE THE CONNECTION.
odbc_close($connection);
}
?>
ok this populates a drop down combo box from a database.
When an item is selected on the combo box the value of it equals the item shown in the combo box and a value sucha as 3.
when the value is submitted to the second page the string is split into 2 parts.
i can do this no problem, but the problem i have is that if the item in the drop down list has a space in it, when the form is submitted it chops the string after the space and only shows what was before the space. I know that i can use "urlencode" & "urldecode" but how do i call this before the form s submitted so that the current value of the select box is encoded. but if the selection is changed the encoded will re encode the new selection value.
If you have any ideas how to do this or need some more explaining cus i know its weird, then please reply with your questions or answers thank you