Dropdown menu

From: Date: Tue, 11 May 2004 07:24:12 +0000
Subject: Dropdown menu
Groups: php.general 
Request: Send a blank email to php-general+get-185881@lists.php.net to get a copy of this message
Hello, A question about forms and PHP. I have a dropdown list which gets the lines in the list from DB. Like this(col1 is used only for sorting the data): echo "<td>choose one:</td><td><SELECT NAME=\"name1\">"; $sql="SELECT col1, col2 FROM table_04 ORDER BY col1"; $result=mysql_query($sql); $num = mysql_num_rows($result); $counter = 1; while ($num >= $counter) { $row = mysql_fetch_array($result); $col2 = $row["col2"]; echo "<option value=\"name\">$col2</option>"; $counter++; } This obviously leaves the value of $col2 to what ever is in the last row in database. How do I set the script to change the value when user selects another name from the list? I need to do more stuff based on the users selection. How do I get the selection from the list to a variable? I haven't really done forms and PHP before ;-) Thanks Bill

« previous php.general (#185881) next »