Jump to content


This topic is now archived and is closed to further replies.


*SOLVED* need help whit date and form functions

Recommended Posts

if ($_POST["Submit"]) {

$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">
<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);

<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">

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

Share this post

Link to post
Share on other sites
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";

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.