Codes here !
Moderators: macek, egami, gesf
by DS928 » Thu Jan 10, 2013 11:25 am
I would like a button to populate my listbox. How would I do this. I have this so far. Also I want the listbox to be empty until the button is pushed. Helpis appreciated. Thank you.
- Code: Select all
<?php
$dbc = mysql_connect('', '','')
or die('Error connecting to MySQL server.');
mysql_select_db('MyDB');
$result = mysql_query("select * from tblRestaurants order by RestName ASC");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SEARCH</title>
</head>
<body>
<p><center>SEARCH</CENTER></P>
<select name="RestName">
<?php
while ($nt= mysql_fetch_assoc($result))
{
echo '<option value="' . $nt['RestID'] . '">' . $nt['RestName'] . '</option>';
}
?>
</select>
<p> SPACE</p>
<p></p>
<p>Click "SUBMIT" to display the calculation results</p>
<input type="submit" name="Submit" value="Submit" />
<br />
</form>
</body>
</html>
-
DS928
- New php-forum User

-
- Posts: 2
- Joined: Wed Jan 09, 2013 4:44 pm
Return to mySQL & php coding
Who is online
Users browsing this forum: No registered users and 1 guest