Jump to content

calculate date


b3nky

Recommended Posts

Hello!

 

first of sorry if similar thread exist. i'm little bit in hurry, i have exam on wednesday. this is beginner question.

 

i'm working on some jqm site (ovulation calculation calendae).

 

i have a form in which user enters in first field number (days of cycle)

in second one enters the date from calendar. the date is in format y-m-d

 

my problem is how to manage in php, so he can take days of cycle and add it to date chosen by user?

 

this is my current progress...i know it looks simple to you...but this is my beginning.

 

<form action="php.php" method="post">
		<label for="slider-0">Cycle:</label>
		<input type="range" name="slider" id="slider-0" value="30" min="20" max="40" />
		<label for="defcal">Beginning of last menstrual cycle?</label><input name="defcal" type="date" data-role="datebox" id="defcal" data-options='{"mode": "calbox"}'/>
		<input type="submit" value="Calculate" />
	</form>

 

<?php

$ciklus= $_POST["slider"];
$zciklus= $_REQUEST["defcal"];
$zciklus= strtotime($zciklus);

$ciklus= date('d');
$datum= date('d-M-y	', strtotime("+10 days"));

echo "Cycle value is bla bla bla: ".$ciklus . "days.<br>";
?>

 

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/263666-calculate-date/
Share on other sites

Archived

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

×
×
  • 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.