Note that there are some explanatory texts on larger screens.

plurals
  1. POphp code for checkbox html form
    text
    copied!<p>this is my first time here, so please bear with me.. this is my html form :</p> <pre><code>&lt;form method="post" action="contactformprocess.php"&gt; &lt;input id="name" name="name" type="text" value="" /&gt; &lt;br /&gt; &lt;input id="phone" name="phone" type="text" value=" /&gt;&lt;br /&gt; &lt;input id=" email " name="email " type="text " value=" " /&gt;&lt;br /&gt; &lt;textarea rows="5 " id="message " name="message " cols="20 "&gt;&lt;/textarea&gt;&lt;br /&gt; &lt;input id="submit " name="submit " value="שלחו " type="submit " &gt;&lt;br /&gt; &lt;input id="checkbox " type="checkbox " checked="yes " value="i want to recive weekly updates from you "/&gt; i want to recive weekly updates from you &lt;br /&gt; &lt;/form&gt; </code></pre> <p>this is the php code im using :</p> <pre><code>&lt;?php $emailSubject = '.....'; $webMaster = 'aa@aa'; $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $message = $_POST['message']; $body = &lt;&lt;&lt;EOD &lt;br&gt;&lt;hr&gt;&lt;br&gt; Subject: $option&lt;br&gt; Name: $name &lt;br&gt; Phone: $phone&lt;br&gt; Email: $email &lt;br&gt; Message: $message &lt;br&gt; EOD; $headers = "From: $email\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); ?&gt; </code></pre> <p>what I am missing is the php script that validates if the checkbox was unchecked(it's set to checked) or checked and sends the info together with the other fields. if checked send 'YES', if uncheck send 'NO' or nothing. thanks :) </p>
 

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