noobyphpchick
11-22-2007, 10:05 AM
Hi
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!!
if(isset($select)&&$select!=""){
$select=$_POST['select'];
}
//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.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['customerId']; ?>" <? if($row_list['customerId']==$select){ echo "selected"; } ?>><? echo $row_list['lastName']; ?></option>
<?
}
?>
</select>
//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)
VALUES('$row_list[customerId]','$row_list[videoId]','$_GET[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?
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!!
if(isset($select)&&$select!=""){
$select=$_POST['select'];
}
//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.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['customerId']; ?>" <? if($row_list['customerId']==$select){ echo "selected"; } ?>><? echo $row_list['lastName']; ?></option>
<?
}
?>
</select>
//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)
VALUES('$row_list[customerId]','$row_list[videoId]','$_GET[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?