Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP emailer to provide answer to checkbox
    text
    copied!<p>Got some great help yesterday with some php code for a mailer and forgot that I also need to know how to include the code so the mailer knows which option is checked in the checkbox. It is a simple 'join mailing list' option with only a yes or no option available.</p> <p>Code is as follows:</p> <pre><code> &lt;?php $state = 0; // check to see if verificaton code was correct if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verification code was correct send the message and show this page mail("myemail@gmail.com", 'Online Form: '.$subject, "\n".$message." \n\n".$name."\n\n".$lastname."\n\n".$from."\n\n".$_SERVER['REMOTE_ADDR']." \n\n".'mailinglist: '.$mailinglist, "From: $from"); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon',''); $state = 2; } else if(isset($message) and $message!=""){ // if verification code was incorrect then return to contact page and show error $state = 1; } if ($state == 0) { ?&gt; </code></pre> <p>I tried playing with this a bit to see if I could figure it out, but thought I would stop before I get ahead of myself and totally mess it up:</p> <pre><code> &lt;td align="left"&gt;&lt;input type=checkbox name="mailinglist" id="mailinglist" value="1&lt;?php echo $_GET['mailinglist'];?&gt;"&gt;Yes&lt;input type=checkbox name="mailinglist" id="mailinglist" value="2&lt;?php echo $_GET['mailinglist'];?&gt;"&gt;No&lt;font face="Verdana" size="3" color="#666666"&gt;&lt;/font&gt;&lt;br&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr valign="top" align="right"&gt; &lt;td nowrap&gt;&lt;font face="Verdana" size="3" color="#666666"&gt;comments (&lt;span class="R"&gt;*&lt;/span&gt;)&lt;/font&gt;&lt;/td&gt; </code></pre>
 

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