Hello!
I am a newbie to PHP-MySQL. I am trying to populate 2 drop down lists from a MySQL DB. First drop down list(Build_Name) has building names and 2nd one has dates(Pickup_Dates) .
These r my two tables...
CREATE TABLE Buildings (
Bldg_Name varchar(25) NOT NULL default '' PRIMARY KEY,
Driver_ID tinyint(2) NOT NULL default '0'
) TYPE=MyISAM;
CREATE TABLE order (
Order_ID INT(5) NOT NULL default 101,
Bldg_Name varchar(25) NOT NULL default '',
Pickup_Date date NOT NULL default '0000-00-00',
PRIMARY KEY (Order_ID,Delivery_Date,Bldg_Name)
) TYPE=MyISAM;
Pls look the below code...
all i see is a small drop down list with no values in it? whats wrong with this code? Also I have to have 2 drop down lists(one for homes and other for pickup dates from homes & orders tables. once a user chooses lets say home1 from homes drop down list and 10/02/2004 from pickup dates drop down list If a record exists it should display the order info else user will be able to insert a new record for the chosen home & pickupdate along with other info... how to insert into db this form...?
I really appreciate all the help...just started learning PHP still I am not able to crack this one...
<HTML>
<select name="home_name">
<?php
include "mysql_data.inc"; //contains db connection string ONLY
$strsql = "select Home_Name from homes";
$rsTmp = mysql_query($strsql) or die("Query failed");
while($rowTmp = mysql_fetch_array($rsTmp,MYSQL_BOTH)) { ?>
<option><?=$rowTmp[1]?></option>
<?php } ?>
</select>
</HTML>
Why is my Drop Down List EMPTY?
Thanks,
Sean