Hi all,
I have two textfields with names: date[1], date[2]
If the user only enters data into only one of the textfields how do I ensure that the empty value will not get inserted into the database also??
Here's my code to date. At the moment the empty data gets inserted...
foreach($date as $key => $value)
{
$find_date = mysql_query("select date from date where date = '$value'
and course_ID = '$course' LIMIT 1");
if (mysql_num_rows($find_date) > 0)
{
$date_id = mysql_result($find_date, 0);
echo $value.' date already added<br /><br />';
}
else
{
// Perform Update Query
$query = "Insert into date values(NULL, '".$value."', '".$course."')";
$result = mysql_query($query) or die(mysql_error());
} // end else
} // end foreach clause
Thanks.