0

Following up with post Php Date validation function

It turns out there is already a date validation function on the page which I created a while back with a DreamWeaver form validation assistant. I dont have that computer or plugin anymore. I would like to keep that function but just implement the new 7 day restriction instead of a static one. The current call to the function is

WAValidateDT(document.form1.x_po_num,'- Invalid Date',true,/.*/,'mm-dd-yyyy','1/1/2000','1/1/2020',false,/.*/,'','','',document.form1.x_po_num,0,true);

As you can see it sends the function a bunch of parameters and where it says 1/1/2000, that is minimum date allowed. I tried to piece together some of the help I received above and on the web and tried ...

<?php 
$Date1 = date("m/d/Y");
$date = new DateTime($Date1);
$date->add(new DateInterval('P7D')); 
$Date2 = $date->format('m-d-Y');

?>

WAValidateDT(document.form1.x_po_num,'- Invalid Date',true,/.*/,'mm-dd-yyyy','<?php $Date2 ?>','1/1/2020',false,/.*/,'','','',document.form1.x_po_num,0,true);

but it doesnt appear to be sending anything.

Where am I going wrong? How would I send the function a varying date instead of the old hardcoded one? Thanks!

Rich Gags
  • 21
  • 1

1 Answers1

0

Simply putting the variable $Date2 shouldn't work. Could you try to echo it?

MrPerry95
  • 29
  • 1
  • 1
  • 8