Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get selected radio button value onclick from php
    primarykey
    data
    text
    <p>I want to get the selected radio button's value in php.</p> <p>code: update.php</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="css/common.css" type="text/css"&gt; &lt;link rel="stylesheet" type="text/css" href="css/page.css"&gt; &lt;link href="css/loginmodule.css" rel="stylesheet" type="text/css" /&gt; &lt;script&gt; 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 &amp;&amp; xmlhttp.status == 200) { document.getElementById("txtHint").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "gettheater.php?q=" + str, true); xmlhttp.send(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Welcome &lt;?php echo $_SESSION['SESS_FIRST_NAME']; ?&gt;&lt;/h1&gt; &lt;a href="member-profile.php" class="log"&gt;My Profile&lt;/a&gt; | &lt;a href="logout.php" class="log"&gt;Logout&lt;/a&gt; &lt;p&gt;This is a password protected area only accessible to Admins. &lt;/p&gt; &lt;center&gt; &lt;div class="pan"&gt;&lt;br&gt;&lt;br&gt; &lt;div class="head"&gt;Remove Theater From List&lt;/div&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST" &gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="Theatername"&gt;Theater Name&lt;/label&gt;&lt;/td&gt; &lt;td&gt; &lt;?php try { $dbh = new PDO('mysql:dbname=theaterdb;host=localhost', 'tiger', 'tiger'); } catch (PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); } $sql = "SELECT theater_name FROM theater;"; $sth = $dbh-&gt;prepare($sql); $sth-&gt;execute(); echo "&lt;select name='theater_name' id='course' onchange='showUser(this.value);'&gt;"; echo "&lt;option&gt;----Select Theater----&lt;/option&gt;"; while ($row = $sth-&gt;fetch(PDO::FETCH_ASSOC)) { echo "&lt;option value='" . $row['theater_name'] . "'&gt;" . $row['theater_name'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/form&gt; &lt;tr&gt; &lt;td&gt; &lt;form method="POST"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="Address"&gt;Address&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;div id="txtHint"&gt; &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" name='Remove From List' value="Remove From List" class="getvalue" onclick="&lt; ? php myfunc() ? &gt;"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/table&gt; &lt;/form&gt; &lt;br&gt;&lt;br&gt; &lt;/tr&gt; &lt;/td&gt; &lt;?php if (isset($_POST['Submit'])) { echo $_POST['address']; } ?&gt; &lt;/div&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Code<br> gettheater.php</p> <pre><code>&lt;?php $q = strtolower(trim($_GET["q"])); try { $dbh = new PDO('mysql:dbname=theaterdb;host=localhost', 'tiger', 'tiger'); } catch (PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); } $sql = 'SELECT address FROM theater WHERE LOWER(theater_name) = :q'; $sth = $dbh-&gt;prepare($sql); $sth-&gt;bindValue(':q', $q); $sth-&gt;execute(); echo "&lt;form name='theater' method='POST' action='update.php'&gt;"; echo "&lt;table border='0' class='tabs'&gt;&lt;tr&gt;&lt;th&gt;Theater Address&lt;/th&gt;&lt;th&gt;Select&lt;/th&gt;&lt;/tr&gt;"; while ($row = $sth-&gt;fetch(PDO::FETCH_ASSOC)) { echo "&lt;tr&gt;"; echo "&lt;td class='ad'&gt;" . $row['address'] . "&lt;/td&gt;"; echo "&lt;td&gt;"; echo '&lt;input type="radio" name="address" value="43" /&gt;'; echo "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; echo "&lt;/form&gt;"; $dbh = null; ?&gt; </code></pre> <p>The html for the radio button is in <code>gettheater.php</code> page. but I am running the <code>update.php</code> the gettheater page is opening in <code>update.php</code> but how can I get the selected radio button value and I want to get the selected radio button value in <code>update.php</code>.</p> <p>How can I do this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload