Jump to content

Recommended Posts

[code]
<?php
if ($_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
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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.