View Full Version : insert to database table from drop down

11-22-2007, 11:05 AM
im really stuck on this
my form uses 2 drop downs and an input field (date) to insert a value into a table on the database, the 2 dropdowns values are from 2 other tables, so my query is not working i think.
I can insert into the database a date but it does not take the drop down values. I must be close as it almost works!!

//form bits....then

select name="select">
<option value="">--- Select LastName---</option>

$list=mysql_query("select * from customer order by customerId asc");

// Show records by while loop.
<option value="<? echo $row_list['customerId']; ?>" <? if($row_list['customerId']==$select){ echo "selected"; } ?>><? echo $row_list['lastName']; ?></option>


//then there is another select like the first... a normal submit

<input type="submit" name="Submit" value="Select" />
//and the query

$result = "INSERT into loan (customerId, videoID, date)

//followed by
$result = mysql_query("SELECT customerId, videoId, date FROM loan where customer.lastName='$select' && video.title='$select' ");
//to try and get it displaying - but from different tables-EEK! complicated!!

so does anyone know why its only inserting the date and not the other values, is it my query that needs work or something else?

11-23-2007, 10:13 AM
try this: