javascript - How to get the radio button value from php -


i want radio button value in php.the thing having drop down in 1 page, when select value dropdown, sends value ajax , php , php page generating radio button.

now want radio button value. how can it?

code

index.php

   <script>                     function showuser(str) {                         if(str=="") {                             document.getelementbyid("txthint").innerhtml="";                             return;                         }                          if(window.xmlhttprequest) {                             xmlhttp=new xmlhttprequest();                         } else {                             xmlhttp=new activexobject("microsoft.xmlhttp");                         }                          xmlhttp.onreadystatechange = function() {                             if(xmlhttp.readystate==4 && xmlhttp.status==200) {                                 document.getelementbyid("txthint").innerhtml=xmlhttp.responsetext;                             }                         }                         xmlhttp.open("get","gettheater.php?q="+str,true);                         xmlhttp.send();                     }     </script>   <div id="txthint">   </div> 

code: gettheater.php

<?php $q = strtolower(trim($_get["q"]));  try {     $dbh = new pdo('mysql:dbname=theaterdb;host=localhost','tiger','tiger'); } catch (pdoexception $e) {     echo 'connection failed: ' . $e->getmessage(); }  $sql = 'select address theater lower(theater_name) = :q';  $sth = $dbh->prepare($sql); $sth->bindvalue(':q', $q); $sth->execute();  echo "<form name='theater' method='post'>"; echo "<table border='0' class='tabs'><tr><th>theater address</th><th>select</th></tr>";  while($row = $sth->fetch(pdo::fetch_assoc))  {   echo "<tr>";   echo "<td class='ad'>" . $row['address'] . "</td>";   echo "<td>";    echo '<input type="radio" name="address" value="43"  />';   echo "</td>";   echo "</tr>"; }  echo "</table>"; echo "</form>"; $dbh = null;  ?> 

from pure javascript point can grab radio boxes name address , find 1 selected.

function getselectedvalue() { var addresses = document.getelementsbyname('address'); (var i=0; < addresses.length; i++) {    if (addresses[i].checked) return addresses[i].value; } } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -