Hello - I am trying to get a looping date repeater to work but it is driving me crazy! It works for most dates but breaks for dates that originate in early November. I created a page that shows the code and the output for anyone to see what is going on. The page is here:
Here is the code, which is also on the page.
$counter=0;
$i=1; // TEST LOOP START
$sequence = $_POST['sequence']; // days
$repeat = $_POST['repeat']; // number of records
$originaldate = $_POST['year'] ."-".$_POST['month'] ."-" . $_POST['day']; // BREAKS IN EARLY NOVEMBER!!
while($i<=$repeat)
{
$counter = $counter + 1;
$s = ($sequence * $counter);
$newdate = date('Y-m-d',(strtotime($originaldate) + (86400 * $s)));
echo $newdate . " : s= " . $s . " : i= " . $i . ": counter= " . $counter . "<br />";
$i++; // END LOOPER
}
I also included the results of the variables in the output to help troubleshoot. Try November 3 to start and click submit to see what happens.
How can I fix this? Is my code any good? What can I do?!
Thanks for any asasistance!