canadian_angel Posted June 16, 2010 Share Posted June 16, 2010 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']; ?> Link to comment https://forums.phpfreaks.com/topic/204951-any-help-would-be-great-need-to-add-a-loop-to-my-code-and-am-confused/ Share on other sites More sharing options...
cvken Posted June 16, 2010 Share Posted June 16, 2010 Not a big fan of math problems like that but...why the loop???? It seems like all you need is a simple math and then show the solution??? Link to comment https://forums.phpfreaks.com/topic/204951-any-help-would-be-great-need-to-add-a-loop-to-my-code-and-am-confused/#findComment-1073041 Share on other sites More sharing options...
canadian_angel Posted June 16, 2010 Author Share Posted June 16, 2010 I was just told to add a loop, I am not a big fan of math either. I am just confused and not sure how to calculate the php script. Link to comment https://forums.phpfreaks.com/topic/204951-any-help-would-be-great-need-to-add-a-loop-to-my-code-and-am-confused/#findComment-1073052 Share on other sites More sharing options...
katierosy Posted June 18, 2010 Share Posted June 18, 2010 Please let us know exactly the point/stage of difficulty. If you are new to PHP, you may read some example scripts on web and try to read and understand them. Link to comment https://forums.phpfreaks.com/topic/204951-any-help-would-be-great-need-to-add-a-loop-to-my-code-and-am-confused/#findComment-1074087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.