Skip to content

Instantly share code, notes, and snippets.

@casspangell
Created February 1, 2011 02:40
Show Gist options
  • Save casspangell/805314 to your computer and use it in GitHub Desktop.
Save casspangell/805314 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar</title>
<!-- link calendar files -->
<script language="JavaScript" src="calendar_us.js"></script>
<link rel="stylesheet" href="calendar.css">
</head>
<body>
<?php
$username="cpangell_irt";
$password="irtsoftware";
$database="cpangell_calendar";
if(isset($_POST['submit'])){
$schedule_of_day=$_POST['submit'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die(mysql_error());
//query the db
$query="SELECT schedule_of_day FROM Calendar WHERE schedule_of_day = '" . $testinput ."' AND time is null";
echo "$query";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$Date=$row['schedule_of_day'];
//display
echo "<p>Date: " . $Date . "</p>";
}
}else{
echo "<p>Please select a date to search for available time slots</p>";
}
?>
<body>
<form name="testform" method="post" action="calendar_v2.php">
<!-- calendar attaches to existing form element -->
<input type="text" name="testinput" disabled="disabled"/>
<script language="JavaScript">
new tcal ({
// form name
'formname': 'testform',
// input name
'controlname': 'testinput'
});
</script>
<br />
<label>
<input type="submit" name="submit" id="schedule_of_day" value="See Available Times" />
</label>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment