Button to populate listbox

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Wed Jan 09, 2013 4:44 pm

Button to populate listbox

Postby 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

$dbc = mysql_connect('', '','')
     or die('Error connecting to MySQL server.');


$result = mysql_query("select * from tblRestaurants order by RestName ASC");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />




<select name="RestName">
while ($nt= mysql_fetch_assoc($result)) 
     echo '<option value="' . $nt['RestID'] . '">' . $nt['RestName'] . '</option>';

<p> SPACE</p>


<p>Click "SUBMIT" to display the calculation results</p>

<input type="submit" name="Submit" value="Submit" />

<br />




Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 3 guests