Location: PHPKode > projects > Run > Run-0.8.0.2/Run-0.8.0.2/logrun.php
<?php
include("system/functions.php");
include("system/environment.php");
?>

<html>
<?php
include("system/head.php");
?>
<body>

<div class="logo"><img src="system/imgs/runsmall.png"></div>

<?php
if ($_POST["submit"]) {
	//first put the date into proper form for database input: YYYY-MM-DD
	$date = dateFormat($_POST['RunDay'], $_POST['RunMonth'], $_POST['RunYear']);

	//then put the time into proper format for database input: HH:MM:SS
	$time = timeFormat($_POST['RunHours'], $_POST['RunMinutes'], $_POST['RunSeconds']);

	//if data is filled-in process the form
	$query = "insert into $mysqlTableRunningLogs (RunnerID, Date, TimeOfDay, Time, Distance, DistanceUnit, RunType, Surface, Terrain, Weather, Temperature, TemperatureUnit, AHR, Weight, WeightUnit, Shoes, Feeling, Notes) values ('$user', '".$date."', '".$_POST["TimeOfDay"]."', '".$time."', '".$_POST["Distance"]."', '".$_POST["DistanceUnit"]."', '".$_POST["RunType"]."', '".$_POST["Surface"]."', '".$_POST["Terrain"]."', '".$_POST["Weather"]."', '".$_POST["Temperature"]."', '".$_POST["TemperatureUnit"]."', '".$_POST["AHR"]."', '".$_POST["Weight"]."', '".$_POST["WeightUnit"]."', '".$_POST["Shoes"]."','".$_POST["Feeling"]."','".$_POST["Notes"]."')";
	mysql_query($query) or die(mysql_error());

	echo "<html><head><meta http-equiv=\"refresh\" content=\"3; url=javascript:window.close()\"></head><body><div class=\"inputconfirm\">Information about your run has been successfully added.</div></body></html>";
} else {
	//print the form
?>

<div class="content">
<b>Runner: <?php echo $user ?></b>
<p class="header">Log a Run</p>

<form class="log" method="post" action="<?php $_SERVER['PHP_SELF']?>">
<table width="300px" border="0">

<tr>
<td class="right">Date:</td>
<td class="left">
<select name="RunDay" class="log">
<option value="<?php echo date("d")?>"><?php echo date("d")?></option>
<?php
generateDays();
?>
</select>

<select name="RunMonth" class="log">
<option value="<?php echo date("m")?>"><?php echo date("F")?></option>
<?php
generateMonths();
?>
</select>

<select name="RunYear" class="log">
<option value="<?php echo date("Y")?>"><?php echo date("Y")?></option>
<?php
generateYears();
?>
</select>

</tr>

<tr>
<td class="log">Time of Day:</td>
<td><select class="log" name="TimeOfDay">
<option value=""></option>
<option value="Dawn">Dawn</option>
<option value="Morning">Morning</option>
<option value="Noon">Noon</option>
<option value="Afternoon">Afternoon</option>
<option value="Evening">Evening</option>
<option value="Night">Night</option>>
</select></td>
</tr>

<tr>
<td class="log">Time:</td>
<td>
<select name="RunHours" class="log">
<option value="00">Hours</option>
<?php
generateHours();
?>
</select>

<select name="RunMinutes" class="log">
<option value="00">Minutes</option>
<?php
generateMinSec();
?>
</select>

<select name="RunSeconds" class="log">
<option value="00">Seconds</option>
<?php
generateMinSec();
?>
</select>
</td>
</tr>

<tr>
<td class="log">Distance:</td>
<td class="descript"><input class="log" type="text" name="Distance" size="2" maxlength="4">
<select class="log" name="DistanceUnit">
<?php
//system/environment.php holds an if statement that chooses between either a preset value from the settings or from a value selected from the drop-down menu
distanceUnitsShort($distanceUnit);
?>
</select></td>
</tr>

<tr>
<td class="log">Run Type:</td>
<td><select class="log" name="RunType">
<option value=""></option>
<option value="Slow">Slow</option>
<option value="Intermediate">Intermediate</option>
<option value="Quick">Quick</option>
<option value="Fartlek">Fartlek</option>
<option value="Interval">Interval</option>
<option value="Hill Run">Hill Run</option>
<option value="Hill Interval">Hill Interval</option>
<option value="Taper">Taper</option>
<option value="Tempo">Tempo</option>
<option value="Tempo Interval">Tempo Interval</option>
<option value="Race">Race</option>
<option value="Walk">Walk</option>
<option value="Walk-Run">Walk-Run</option>
<option value="Other">Other</option>
</select></td>
</tr>

<tr>
<td class="log">Surface:</td>
<td><select class="log" name="Surface">
<option value=""></option>
<option value="Asphalt">Asphalt</option>
<option value="Gravel">Gravel</option>
<option value="Roads">Roads</option>
<option value="Track">Track</option>
<option value="Trail">Trail</option>
<option value="Varied">Varied</option>
</select></td>
</tr>

<tr>
<td class="log">Terrain:</td>
<td><select class="log" name="Terrain">
<option value=""></option>
<option value="Downhill">Downhill</option>
<option value="Flat">Flat</option>
<option value="Rolling Hills">Rolling Hills</option>
<option value="Uphill">Uphill</option>
<option value="Varied">Varied</option>
</select></td>
</tr>

<tr>
<td class="log">Weather:</td>
<td><select class="log" name="Weather">
<option value=""></option>
<option value="Cloud">Cloud</option>
<option value="Clear">Clear</option>
<option value="Drizzle">Drizzle</option>
<option value="Fog">Fog</option>
<option value="Freezing">Freezing</option>
<option value="Hot">Hot</option>
<option value="Humid">Humid</option>
<option value="Partly Cloudy">Partly Cloudy</option>
<option value="Rain">Rain</option>
<option value="Snow">Snow</option>
<option value="Sun">Sun</option>
<option value="Wind">Wind</option>
</select></td>
</tr>

<tr>
<td class="log">Temperature:</td>
<td class="descript"><input class="log" type="text" name="Temperature" size="2" maxlength="2">
<select class="log" name="TemperatureUnit">
<?php
//system/environment.php holds an if statement that chooses between either a preset value from the settings or from a value selected from the drop-down menu
temperatureUnitsShort($temperatureUnit);
?>
</select></td>
</tr>

<tr>
<td class="log">Average HR:</td>
<td class="descript"><input class="log" type="text" name="AHR" size="3" maxlength="3"> bpm</td>
</tr>

<tr>
<td class="log">Weight:</td>
<td class="descript"><input class="log" type="text" name="Weight" size="3" maxlength="3">
<select class="log" name="WeightUnit">
<?php
//system/environment.php holds an if statement that chooses between either a preset value from the settings or from a value selected from the drop-down menu
weightUnitsShort($weightUnit);
?>
</select></td>
</tr>

<tr>
<td class="log">Shoes:</td>
<td><select class="log" name="Shoes">
<option value=""></option>
<?php
$getshoes = mysql_query("select distinct ShoeName from $mysqltableshoes where ((RunnerID='$user') and (ShoeRetired!='Y')) order by ShoeName");
while ($shoes = mysql_fetch_array($getshoes)) {
	printf("<option value=\"%s\">%s</option>", $shoes["ShoeName"], $shoes["ShoeName"]);
}
?>
</select>
</td>
</tr>

<tr>
<td class="log">How I Felt:</td>
<td><select class="log" name="Feeling">
<option value=""></option>
<option value="Excellent">Excellent</option>
<option value="Good">Good</option>
<option value="Neutral">Neutral</option>
<option value="Bad">Bad</option>
</select></td>
</tr>

<tr>
<td class="log" valign="top">Notes:</td>
<td><textarea class="log" name="Notes" rows="7" cols="40" wrap="virtual"></textarea></td>
</tr>

<tr>
<td></td>
<td class="left">
<input class="log" type="submit" name="submit" accesskey="s" value="Submit">&nbsp;
<input class="log" type="submit" accesskey="w" value="Wipe">
</td>

</tr>
<tr><td align="right" colspan="2"><a href="javascript:window.close();" title="Close This Window: Alt+C" accesskey="c" class="url"><u>C</u>lose</a></td></tr>
</table>
</form>

<?php
}
?>

</div>

</body>
</html>
Return current item: Run