Getting the value from other page
<p>I am getting the value of element in the form through Ajax . Now my problem is <code>xmlhttp.open("GET","simple2.php?q="+str,true);</code> from <code>simple2.php</code> I want to return the value of <code>$q</code> to main page that is <code>simple1.php</code> </p>

<p>So once I get the value of <code>$q</code> on <code>simple1.php</code> then I can do some if condition in PHP. ie </p>

<pre><code>&lt;?php
if ($q =="a" )
{
?&gt;
&lt;div class = "abc" &gt;
&lt;input type="text" name="abc" /&gt;
&lt;?php
}
?&gt;
</code></pre>

<p>Please have a look at the code<br>
simple1.php</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
function showCD(str)
{if (str=="")
  { document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","simple2.php?q="+str,true);
xmlhttp.send();
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;form&gt;
Select a CD:
&lt;select name="cds" onChange="showCD(this.value)"&gt;
&lt;option value=""&gt;Select a CD:&lt;/option&gt;
&lt;option value="Bob Dylan"&gt;Bob Dylan&lt;/option&gt;
&lt;option value="Bonnie Tyler"&gt;Bonnie Tyler&lt;/option&gt;
&lt;option value="Dolly Parton"&gt;Dolly Parton&lt;/option&gt;
&lt;/select&gt;
&lt;/form&gt;

&lt;div id="txtHint"&gt;&lt;b&gt;CD info will be listed here...&lt;/b&gt;&lt;/div&gt;
</code></pre>

<p>Simple2.php</p>

<pre><code>&lt;?php
$q=$_GET["q"];

echo $q;

?&gt;
</code></pre>
