nd3_2000 Posted August 17, 2009 Share Posted August 17, 2009 Hi guys am having a real problem right now, I need to pass a calander control to another page and I cant seem to get it to read the ID of the text box the value is being placed into..... Here is the code <td colspan="2" align="left"><input name="Datelogged" type="text"value ="Click Select" size="15" id="Datelogged" /> <a href="#" name="anchor1" class="style1" id="anchor1" onclick="cal.select (document.forms[0].Datelogged,'anchor1','yyyy-MM-dd'); return false;">select</a></td> </tr> <a href="CompleteProof.php?JobNumber=<?php echo $JobNo; ?>&ProofDate=<?php echo DateLogged; ?>"></BR>[Complete Proof]</a></BR></BR></BR> All I keep getting is this, its just passing through the word Datelogged NOT the date value that is in the text box http://www.xxxxxxxxx.co.uk/CompleteProof.php?JobNumber=PFAug25&ProofDate=DateLogged Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 17, 2009 Share Posted August 17, 2009 Well, first, DateLogged isn't a proper PHP variable. It's a string literal, which is why it's being echoed as-is. Also, it looks like you're confusing the capabilities/uses of PHP and JavaScript. What it looks like you're trying to do is pass an element's value in a query string. PHP cannot obtain this value (at least, not easily). It doesn't work like JavaScript where it automatically keeps a representation of the HTML document that you can directly reference. So, you'll need to use JavaScript in order to fill in the rest. I suggest creating an event handler for a button's onclick event. You can pass into it the $JobNo value, and obtain the DateLogged value all at the same time: function processClick(jobNo){ window.location = "CompleteProof.php?JobNumber=" + jobNo + "&ProofDate=" + document.getElementById('DateLogged').value; } ... <button type="button" onclick="processClick(<?php echo $JobNo; ?>)">[Complete Proof]</button> This should give you something to start with. Quote Link to comment Share on other sites More sharing options...
nd3_2000 Posted August 18, 2009 Author Share Posted August 18, 2009 Hi thanks for your advice with that, I kind of understand what you are saying and realised it was to do with the calanders value not being passed, apologies as Im pretty new to this!!! I placed the code in and when runnign it, it gives me an error like this on the button click "GPAUG20 is undefined" when it tries to send the value of the jobNo through! Any ideas? as have no idea of the solution of this! Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 18, 2009 Share Posted August 18, 2009 What does CPAUG20 supposed to reference? Quote Link to comment Share on other sites More sharing options...
nd3_2000 Posted August 19, 2009 Author Share Posted August 19, 2009 GPAUG20 is the JobNo thats being passed through to it Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 19, 2009 Share Posted August 19, 2009 GPAUG20 is the JobNo thats being passed through to it Okay, I need to see more of your code, especially where/how you've written the function I showed you, and where/how $JobNo is being created. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.