Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to set end date automatically validate duration 1 year? I have start date and end date . The package validation is 1 year from the date customer select or pickup start date for example 2.11.2017 - 2.11.2018 . Now I already have start date and end date form and mysql for that part is not the problem. My problem is how can I set after user pick date from start date and end date automatically appear end date (validation duration) for 1 year? I did not know how to set end date automatically. curently I set end date validate from today to one year. Do i need add javascript? How?

# I just copy the important part. Help me..

What I have tried:


Your Package Start Date (Select Date) :
" name="startdate">




Your Package End Date :
<input type="date" value="<?php echo date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 365 day"));?>" name="enddate">







<?php
$connection = mysql_connect("localhost", "root", "");
$db = mysql_select_db("workshire", $connection);

if(isset($_POST['submit'])){
$startdate = $_POST ['startdate'];
$enddate = $_POST ['enddate'];{
//Insert Query of SQL
$query = mysql_query("INSERT INTO `talent_pool` (`start_validate`,`end_validate`)
VALUES ('$startdate','$enddate')");
echo "

You Register Success";
}
}
mysql_close($connection); // Closing Connection with Server
?>
Posted
Updated 13-Nov-17 9:22am

1 solution

What we do is to make an AJAX call with initial date, then get date + 1 year and validate it using javascript after that.. mysql : SELECT '$date' + 365 DAY
You can check it implemented on date picker here : http://www.tixik.com/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900