MySQL Forums
Forum List  »  MyISAM

now implemented SET -- but how do i use it w/ PHP and an HTML form?
Posted by: Jeff Sabarese
Date: December 21, 2005 06:53AM

okay-- here's what i'm trying-- and it's not working-- however, i think it's due to erroneous PHP / HTML form. please take a look at below (which i copied from the post i made in a php users forum. sorry for being lazy!)

i'm building a <select><option> form element using this array and a FOREACH statement to populate the dropdown list.
PHP Code:
$routes = array(
"A" => "routeA", "B" => "routeB", "C" => "routeC",
"D" => "routeD", "E" => "routeE", "F" => "routeF",
"G" => "routeG", "H" => "routeH", "I" => "routeI",
"J" => "routeJ", "K" => "routeK", "L" => "routeL",
"M" => "routeM", "N" => "routeN", "O" => "routeO",
"P" => "routeP", "Q" => "routeQ");

at this point, i'm just using this query:
PHP Code:
mysql_query("UPDATE table SET ... near_routes='".$_POST['near_routes']"') WHERE id = '".$_POST['id']."'");

but i'm only getting one of my selections from my multiple option values.

PHP Code:
$tranSelector = "<select name=\"near_transfer\" multiple=\"yes\" size=\"3\"
style=\"text-align: left;\">";

foreach ($routes as $key => $value) {
$tranSelector .= "<option value=\"".$key."\">".$key." - ".$value."</option>";
}
$tranSelector .= "</select>";

can you see from this excerpt what am i doing wrong? (ive never tried sending multiple options, so i assume this is where i'm in error.?)

thanks for your help!!

-- -- -- --
Use CSS [ content:" ?? " ] for Unicode + Control Chars (e.g. newline, etc)... Gain understanding of Codepage, Charset, Encoding, Keymapping... Generate CSS and JavaScript on-the-fly with PHP... Tales from the Communications Dept @ NoviceNotes.Net

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.