Re: PHP & Javascript
| From: | Mikael Grön | Date: | Thu, 19 Apr 2007 08:08:49 +0000 |
| Subject: | Re: PHP & Javascript | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-27724@lists.php.net to get a copy of this message | ||
Yes, of course.
Though, the security part of this should be in 'another.php' and focused on handling the incoming var from $_GET['UID']...
On the JavaScript side of things, nothing but the client browser is vulnerable anyway.
Mike
Aleksandar Vojnovic skrev:
And don't forget to add $thevariablecontainingthenumbertwo = intval($thevariablecontainingthenumbertwo); or stripslashes Mikael Grön wrote:Google! is your friend, but I acutally enjoy typing. :) Do something like this: <script type="text/javascript"> window.location="another.php?UID=<?php echo $thevariablecontainingthenumbertwo; ?>"; </script> or something like that. :) You know, PHP parses before the browser gets to do JavaScript stuff, so when the browser gets the code, it'll say UID=2 ... or what ever variable you've got stored in $thevariablecontainingthenumbertwo. Mike Alf Stockton skrev:Please suggest a way to pass the value contained in a PHP variable to Javascript. I have $ID with a certain value in PHP and want to do a Javascript window.location="Another.php?UID="+2; and replace the above hardcoded 2 with the value in $ID.