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

Reply via email to