I am trying to pass "selectdate", which is a selected date from a menu, using this With variables:
& lt; Class = "addlink" href = "javascript: togglevis (\ 'addform \', \ 'selecteddate ='. $ Day. '/'. $ Month. '/' $ Year. '\');" & Gt; Add date & lt; / A & gt;
In a form with the following input:
& lt; Input type = "text" name = "startdate" id = "startdate" class = "standard" onchange = "document.getElementById ('startdate'). Value = this.value" value = "& lt ;? php if (isset ($ _gET ['selecteddate']) {echo str_replace ('-', '/', $ _ GET ['selecteddate']);} else {echo date ("j / m / y", mktime ()) ;}? & Gt; "/ & gt;
Toggle form and everything works, except that it always holds the current date from the second date. I am relatively certain that I am not coming through the selected date, if I remove more statements then I end up with an empty text box. As any suggestion, how should I format Adl for sending the date to the form? Thanks for any help, the first time posters and searching around this site have solved a lot of problems, of course a great resource!
< / P>
& lt; Input type = "text" name = "startdate" id = "startdate" class = "standard" onchange = "document.getElementById ('startdate'). Value = this (for example '-', '/', $ _ GET ['selecteddate']);} and {echo date (value) "j / m / y", mktime ());}? & Gt;
Keep in mind that all PHP codes are called before the page is presented in the browser. So when the page is provided then you are ending with:
& gt; Input type = "text" name = "start" id = "start" class = "standard" onchange = "document.getElementById ('startdate'). Value = this.value" value = "& lt;? Date (" j / M / y ", mktime ());)? & Gt;" / & gt;
I have no other answer because I do not completely follow what you already have / try to do with it, but hopefully this help Does it!
In addition to this! When you are testing your code, if you are always getting other from one statement, then it usually means that the element you want to check is not yet present. When you run into that problem, try
var_dump ()
on its variable
Comments
Post a Comment