Note that there are some explanatory texts on larger screens.

plurals
  1. PORadio button on form field always submitting as ON/TRUE
    primarykey
    data
    text
    <p>I have a fairly basic form set up with an input field for a single radio button.</p> <p>There's a php script that processes the form and inserts the values into a mysql database. For some reason, every time I fill the form out, regardless of whether I have the radio selected or not, the result is always ON/TRUE.</p> <p>here is my input field:</p> <pre><code>&lt;input type="radio" name="news" id="news" class="radio" value="yes" /&gt; </code></pre> <p>Here is part of the PHP code that is supposed to process that:</p> <pre><code>if(isset($_POST['news'])) { $news = "Yes"; } else { $news = "No"; } </code></pre> <p>Can someone tell me what hte problem is from that code or would I need to post more?</p> <p>here is the full form code:</p> <pre><code>&lt;form method="POST" id="ipad" name="ipad" action="list.php"&gt; &lt;input type="text" onfocus="if (this.value == 'First Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'First Name';}" value="First Name" id="fname" name="fname" class="inputtext"&gt; &lt;input type="text" onfocus="if (this.value == 'Last Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Last Name';}" value="Last Name" id="lname" name="lname" class="inputtext"&gt; &lt;input type="text" onfocus="if (this.value == 'Email') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Email';}" value="Email" id="email" name="email" class="inputtext"&gt; &lt;input type="text" onfocus="if (this.value == 'Code') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Code';}" value="Code" id="code" name="code" class="inputtext"&gt; &lt;input type="radio" value="" class="radio" id="news" name="news"&gt; &lt;div class="radiotext"&gt;sign up?&lt;/div&gt; &lt;/form&gt; </code></pre> <p>Notice that the radio button input has no javascript being applied to it. I've tried filling in the value="" with YES or NO or leaving it blank. </p>
    singulars
    1. This table or related slice is empty.
    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