Skip to content

Instantly share code, notes, and snippets.

@casspangell
Created January 28, 2011 05:06
Show Gist options
  • Save casspangell/799861 to your computer and use it in GitHub Desktop.
Save casspangell/799861 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>
</head>
<body>
<?php
$username="cpangell_irt";
$password="irtsoftware";
$database="cpangell_calendar";
$date=$_POST['date'];
$time=$_POST['time'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Calendar";
$result=mysql_query($query);
$num=mysql_numrows($result);
$query = "INSERT INTO Calendar VALUES ('','$date','$time')";
mysql_query($query);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$date=mysql_result($result,$i,"date");
$time=mysql_result($result,$i,"time");
echo "date: $date, time: $time";
$i++;
}
?>
<!-- link calendar files -->
<script language="JavaScript" src="calendar_us.js"></script>
<link rel="stylesheet" href="calendar.css">
</head>
<body>
<form name="testform" method="post" action="calendar_v2.php">
<!-- calendar attaches to existing form element -->
<input type="text" name="testinput" />
<script language="JavaScript">
new tcal ({
// form name
'formname': 'testform',
// input name
'controlname': 'testinput'
});
</script>
<br />
<label>
<input type="submit" name="time" id="time" value="Select" />
</label>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment