Well, I probably know just about as much about PHP as you do about javascript so, maybe we can both learn something. One thing I do know about PHP packages (programs set up for a particular use that utilize PHP, like PHP List) is that they work with or without javascript. I hope you are aware that using a script for the date field in your form may, depending upon how the form is set up to act in the absence of javascript, make your form a javascript compatible only form. That being said, one way PHP passes variables to pages that I know of is via information included in the url of the page it is sending information to. Like if the page is called newreply.php and the data to be sent to that page is (as is the case, as I type this reply):
do=newreply
noquote=1
p=9001
the url will be:
newreply.php?do=newreply&noquote=1&p=9001
Is that the method used to send the date back to your page? If so, we need only know what the prefix for the date data is and the form of the said data. To capture it in javascript and assign it to our variables (we will need two, since you are using two dates) we can use a script like this in the head:
Code:
<script type="text/javascript">
var PassedDate1, PassedDate2
if (location.href.indexOf('orderdate=')!==-1)
var PassedDate1=location.href.substr(location.href.indexOf("orderdate=")+10,11)
if (location.href.indexOf('birthdate=')!==-1)
var PassedDate2=location.href.substr(location.href.indexOf("birthdate=")+10,11)
</script>
where orderdate= and birthdate= are the prefixes for the passed dates and +10 is the number of characters in the prefix. This will only work if the data for these prefixes is in this form:
17-OCT-2005
If not, we will need to reformat it before using it and, if something other than a date sometimes follows those prefixes in the url, we will have to screen for that. Let's worry about that later, if it is a problem. Now our DateInput lines will look like this:
HTML Code:
<script>DateInput('orderdate', true, 'DD-MON-YYYY', PassedDate1)</script>
and
HTML Code:
<script>DateInput('birthdate', true, 'DD-MON-YYYY', PassedDate2)</script>
The fact that I have given the DateInputs the same name as our prefixes is just a coincidence but, since they are the names of the fields, they may well become PHP's prefixes when passing their data. Does this point you in the right direction?
Bookmarks