Click here to Skip to main content
15,891,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have a problem with combobox in PHP.
I try to get table's name to combobox, it's work. But I can't get selected value and assign to variable. Please help me. Thank you.
Here is my code:
PHP
$db= mysql_connect("localhost","root","");
	if(!$db)
	{
		echo "error";
		exit;
	}
$table = mysql_query("show tables from sctv_data2 LIKE '%nhap_%'");
echo "<select name = 'venue' >";
while (($row = mysql_fetch_row($table)) != null)
{
    echo "<option value = '{$row['0']}'";
    if ($selected_venue_id == $row['0'])
        echo "selected = 'selected'";
    echo ">{$row['0']}</option>";
}
echo "</select>";
if(isset($_POST['button']))
{
	$a =  $_POST['venue'];
	echo $a; // it's not print $a
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900