Can someone help me with this please. I'm trying to setup a form that a date is entered into, then when search is clicked, it will search the database for that date and if the database holds that date, it will say that date is unavailable, and if the date is not in the database, it will say it's available, simple as that! ANy help as to why this doens't work would be helpful!!!
Here is my code:
<?php
session_start();
include("config.php");
$msg = "salt";
if (isset($_POST['submit']))
{
$event_date = $_POST['event_date'];
$result = mysql_query("Select * From events where event_date='$event_date'",$con);
if(mysql_num_rows($result)>0) {
$row = mysql_fetch_array($result, MYSQL_BOTH);
if($event_date == $row["event_date"]) {
$msg = "This date is unavailable";
}
else {
$msg = "This date is available";
}
}
}
?>
<html>
<head>
<title>Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include "panel.htm"; ?>
<form name="form1" method="post" action="">
<br /><br /><br />
<table class="table" width="35%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000">
<tr>
<td colspan="2"><div align="center"><font color="#669966" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>search</strong></font></div></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Date: </font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="event_date" id="event_date" width="200"></font>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Submit">
</td>
</tr>
</table>
</form>
<?php echo $result; ?>
</body>
</html>