zorce Posted April 24, 2006 Share Posted April 24, 2006 [code]<?phpif ($_POST["Submit"]) {$base_day=date("d");$base_hour=date("H");$base_min=date("i");$base_sec=date("s");$new_day = (base_day + $_POST["skill_day"]);$new_hour = (base_hour + $_POST["skill_hour"]);$new_min = (base_min + $_POST["skill_minute"]);$new_sec = (base_sec + $_POST["skill_second"]);}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="style.css" rel="stylesheet" type="text/css"><style type="text/css"><!--body { background-image: url(_images/site/light.jpg);}--></style></head><body><h2>When is your skill done?</h2><form name="form1" method="post" action="time_calculator.php"> <p>Days: <input name="skill_day" type="text" class="input" size="5"> Hours: <input name="skill_hour" type="text" class="input" size="5"> Minutes: <input name="skill_minute" type="text" class="input" size="5"> Seconds: <input name="skill_second" type="text" class="input" size="5"> <input name="Submit" type="submit" class="knapp" value="Calculate"></p></form><hr></body></html>[/code]I can't work this code out, i try to make a script that calculate whitch day something is done for instens, you write in the form how long time it takes and you get the answer what day / time it is done. plz help me whit this Link to comment https://forums.phpfreaks.com/topic/8274-solved-need-help-whit-date-and-form-functions/ Share on other sites More sharing options...
wildteen88 Posted April 24, 2006 Share Posted April 24, 2006 The reason why it aint working is becuase you aint echo;ing/print'ing anything to the browser therefor no result is displayed!EDIt: This is what you want to do:[code]if (isset($_POST['Submit'])){ $base_day = date("d"); $base_hour = date("H"); $base_min = date("i"); $base_sec = date("s"); $new_day = ($base_day + $_POST['skill_day']); $new_hour = ($base_hour + $_POST['skill_hour']); $new_min = ($base_min + $_POST['skill_minute']); $new_sec = ($base_sec + $_POST['skill_second']); // without this nothing will be displayed! echo "Your Project will be completed in: " . $new_day . " days, " . $new_hour . " hours, " . $new_min . " minutes, and " . $new_sec . " secounds";}[/code] Link to comment https://forums.phpfreaks.com/topic/8274-solved-need-help-whit-date-and-form-functions/#findComment-30177 Share on other sites More sharing options...
zorce Posted April 24, 2006 Author Share Posted April 24, 2006 tnx mate, i get it working now :D Link to comment https://forums.phpfreaks.com/topic/8274-solved-need-help-whit-date-and-form-functions/#findComment-30318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.