Re: urgent guys
| From: | Adam Royle | Date: | Sat, 23 Mar 2002 06:24:50 +0000 |
| Subject: | Re: urgent guys | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17854@lists.php.net to get a copy of this message | ||
You cannot use javascript variables in php, nor php variables in javascript, unless you write the variable to the page (for php -> javascript) or post to a new page with querystring or form (javascript -> php).
php -> javascript:
<script language="JavaScript">
var jsVariable = "<?= $phpVariable ?>";
</script>
javascript -> php:
<script language="JavaScript">
// this is probably wrong javascript syntax, but you get the idea
location.href = "thing.php?q=first+one&p=second+one";
</script>
Adam
i know it has nothing to do with php but i'm stuck:) i have this url: http://localhost/auction/seller/additems.php?category=Books&subcategory=Fiction and in javascript when i say for example alert(category) it gives me undefined....doesn't javascript see variables passed with the url??? Rehab M.Shouman