Location: PHPKode > projects > Mozart > Mozart-0.0.4/addappt.php
<?
// called from: calendar.php
// description: this module gathers info and calls the insert to create a new appointment to the APPOINTMENT table
//
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");
?>
<html>
<title>Mozart: Add New Appointment</title>
<body bgcolor=<? echo $bgcolor ?> text=<? echo $txtcolor ?>>
<?
include("links.inc");
include("getallusers.inc");

printf("<form action=\"insappt.php?Mon=%s&Day=%s&Year=%s&SearchSys\" method=\"post\">", $Mon, $Day, $Year, $SearchSys);
print ("Add Appointment for: <select name=\"ForUser\">");
while ($ownerdata = mysql_fetch_array($OwnerData)) {
	if ($ownerdata["user_id"] == $SearchSys) {
	    $selected = " selected";
	    $selected_user = $ownerdata["user_id"];
	}
	else {
	    $selected = "";
	}
	printf("<option value=%s %s>%s", $ownerdata["user_id"], $selected, $ownerdata["system_id"]);
}
print("</select>");
?>
Month: <select name=SelMon>
<?
$x = 1;
while ($x <= 12) {
	if ($x == $Mon) {
		$selected = " selected";
	}
	else {
		$selected = "";
	}
	printf ("<option%s>%s", $selected, $x);
	$x++;
}
?>
</select>
Day: <select name=SelDay>
<?
$x = 1;
while ($x <= 31) {
	if ($x == $Day) {
		$selected = " selected";
	}
	else {
		$selected = "";
	}
	printf ("<option%s>%s", $selected, $x);
	$x++;
}
?>
</select>
Year: <select name=SelYear>
<?
$current_date = getdate();
$curryear = $current_date["year"];
$x = 1;
while ($x <= 10) {
	if ($curryear == $Year) {
		$selected = " selected";
	}
	else {
		$selected = "";
	}
	printf ("<option%s>%s", $selected, $curryear);
	$x++;
	$curryear++;
}
?>
</select>
<br>
Time:<select name=SelHour>
<?
$x = 0;
while ($x <= 23) {
	printf ("<option>%s", $x);
	$x++;
}
?>
</select>
<select name=SelMinute>
<option>00
<option>15
<option>30
<option>45
</select>
<br>
Appointment Details:<br><textarea cols=50 rows=10 wrap="hard" name=Information></textarea>
<br>
<?
$ProjDataSQL = "SELECT proj_id, name FROM project, userxproj WHERE proj_id = xproj_id AND xuser_id = '$selected_user' ORDER BY name";
$ProjData    = mysql_query($ProjDataSQL);
print ("Associate with project: <select name=\"ForProject\">");
print ("<option value=0>None");
while ($projdata = mysql_fetch_array($ProjData)) {
	printf("<option value=%s>%s", $projdata["proj_id"], $projdata["name"]);
}
print("</select>");

$ContDataSQL = "SELECT xcont_id, last, first FROM contact, userxcont WHERE xuser_id = '$selected_user' AND xcont_id = contact_id ORDER BY last, first";
$ContData    = mysql_query($ContDataSQL);
print ("Associate with contact: <select name=\"ForContact\">");
print ("<option value=0>None");
while ($contdata = mysql_fetch_array($ContData)) {
	printf("<option value=%s>%s, %s", $contdata["xcont_id"], $contdata["last"], $contdata["first"]);
}
print("</select>");

?>
<br>
<input type=submit name=Insert value="Add Appt">
<input type=reset value="Reset">
</form>
<?
include("links.inc");
?>
</body>
</html>
Return current item: Mozart