Re: howto pass javascript variable to php
| From: | Marek Kilimajer | Date: | Mon, 18 Nov 2002 14:53:36 +0000 |
| Subject: | Re: howto pass javascript variable to php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124914@lists.php.net to get a copy of this message | ||
You can still use onclick event to pass value kept in a javascript variable:
<a href="file.php?" onclick="return action('file.php')">
function action(url) {
location.href='http://www.domain.net/' + url + '&var=' + javascript_var;
return false;
}
Jeff Bluemel wrote:
it's easy enough to pass php variable to javascript, but doing this the other way around without a form submit, or location (passing as a php $_GET variable) seems to be a little nightmare. it's easy enough to do it with the form submit, or a location command. thanks, Jeff