Hi,

I have a web site in which I pass many javascript variables to php and the other way round. This is my last passing variable challenge, and I cannot figure it out.

There's an alphabet letter that i pass into showhide1(v) function, and i try to pass it to IN(). For example IN ('b') will retrieve all items beginning with letter b.

The way I did it below does not work for some reason. Does anyone know how to do it?

Thanks

function showhide1(v)
{

<?php
$result = mysql_query("SELECT * FROM birdstable
WHERE left(Name, 1) IN ($_GET[v]) 
ORDER BY Name;"); 

while($row = mysql_fetch_assoc($result)){  
$varr= $row['BirdID'];
?>
document.getElementById("Layer1").innerHTML = "hello";

<?php

}
?>


}

i think you can't get the java script function values by this way: $_GET[v].
if you want to send javascript values to php try this way:

function showhide1(x)
{
d.action="yourpage.php?v="+x;
d.submit();
}

And the you can get the function value by $_GET;
then pass it to N() ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.