Got a problem - trying to calculate the php code !
Posted: Wed Jun 16, 2010 1:25 pm
The thing is I need to write a single script that allows the traveler to calculate how long it will take to travel a specified number of miles based on speed, number of stops, and weather conditions. I need to include code that requires the user to enter numeric values for miles and number of stops. I need to use a radio button that allows users to select good or bad weather. The predetermined miles per hour is 50mph. This is what I have so far, now I am stumped.
<form action="passenger_train.php" method="post">
Speed: <input type="radio" name="speed[]" value="50mph" /> 50 Mph
<br />
<p>Weather Conditions:</p>
<input type="radio" name="weather[]" value="wet" /> Wet
<input type="radio" name="weather[]" value="dry" /> Dry
<br />
Miles: <input type="text" name="miles" size="5" />
<br />
Stops: <input type="text" name="stops" size="5" />
<br />
<input type="submit" name="submit" value="Calculate" />
</form>
<?php
for($i = 0, $x = $nums['x_val'];
?>
<form action="passenger_train.php" method="post">
Speed: <input type="radio" name="speed[]" value="50mph" /> 50 Mph
<br />
<p>Weather Conditions:</p>
<input type="radio" name="weather[]" value="wet" /> Wet
<input type="radio" name="weather[]" value="dry" /> Dry
<br />
Miles: <input type="text" name="miles" size="5" />
<br />
Stops: <input type="text" name="stops" size="5" />
<br />
<input type="submit" name="submit" value="Calculate" />
</form>
<?php
for($i = 0, $x = $nums['x_val'];
?>