Okay, I'm working on the same calculator problem...only I want to have values plugged in by users that are then set to variables within the script. Here's what I have so far, but I cannot get it to work for the life of me:
<form action="http://wls3.com/running/tinman/member/100.php" method="post" >
Hour: <input value="<?php echo $_POST['hour'];?>" name="hour" type="text" size="10" maxlength="10">
Minute: <input value="<?php echo $_POST['minute'];?>" name="minute" type="text" size="10" maxlength="10">
Second: <input value="<?php echo $_POST['second'];?>" name="second" type="text" size="10" maxlength="10">
<input name="" type="submit">
</form>
<? php
$h=$_POST['hour'];
$m=$_POST['minute'];
$s=$_POST['second'];
$d=100;
$distance=100;
$t=$h*3600+$m*60+$s;
$pace=$t/$d;
$pm = intval ($pace/60);
$sc = $pace/60;
$sc1 = (($sc-$pm)*60);
$ps = number_format($sc1, 2, ".", ",");
?>
I am trying to get the values of hour, minute and second to be set for $h, $m and $s. I am also trying to get the values to remain in the text boxes upon 'submit'...hence, the value=<?php... segment, so I post the data to itself. Once I saw something like echo $_SERVER['PHP_SELF'] but didn't know if that would work.
Any comments would be greatly appreciated!!