get option value
Posted: Thu Mar 26, 2009 8:41 pm
this is what im trying to do, i have successfully retrieved values from my DB.
now i have a link next to the option box which will pass the selected value into the next page. How do i get the selected value ??
Here is my link code to link to the page, how do i get the selected option value?
now i have a link next to the option box which will pass the selected value into the next page. How do i get the selected value ??
Code: Select all
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="Users"; // Database name
$tbl_name="members"; // Table name
// Connect to server and select databse.--------------------------------------------------------------------------------------------------------------
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
?>
<?php
//Generate OPTION box--------------------------------------------------------------------------------------------------------------------------------------
$name= mysql_query("select * from $tbl_name"); ?>
<select name="user" id="user">
<?php while($res= mysql_fetch_assoc($name)) { ?>
<option>
<?php echo $res['username']?>
</option>
<?php } ?>
</select>
<a href="<?php echo "test.php";?>">delete</a>Code: Select all
<a href="<?php echo "test.php";?>">delete</a>