Emailing Values from a Checkbox

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Fri Feb 10, 2012 6:54 am

Code: Select all

<form name="testme" method="post" action=".">
<input type="checkbox" name="sendmeemail" value="1"> Send Me E-Mail <br />
<input type="checkbox" name="sendmesnailmail" value="1"> Send Me Postal Mail <br />
<input type="submit" name="action" value="Submit">

Code: Select all

if (isset($_POST['action']) && $_POST['action'] == "Submit") { 
  if (isset($_POST['sendmeemail']) && $_POST['sendmeemail'] == 1) { 
    echo "YAY! You want E-Mail! <br />\r\n";
  } else { 
    echo "You chose not to receive E-Mail <br />\r\n";
  if (isset($_POST['sendmesnailmail']) && $_POST['sendmesnailmail'] == 1) { 
    echo "Yay! You want to receive snail mail! <br />\r\n";
  } else { 
    echo "You chose not to receive snail mail. <br />\r\n";

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest