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!

2
  • ?php $Date2 ?> That does nothing. You are missing an echo statement... <?php echo $Date2 ?> Commented Aug 24, 2017 at 15:23
  • Works perfectly thanks! Commented Aug 24, 2017 at 15:59

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.