[program-l] Re: php checkbox code

  • From: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 11 Oct 2012 00:09:57 +0200

isset()

As in, if a checkbox isn't checked, then it won't be submitted to the script:
if (isset($_POST["chkBoxName"])) {
//check box was checked
}

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Bryan Schulz" <b.schulz@xxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Wednesday, October 10, 2012 11:04 PM
Subject: [program-l] php checkbox code


hi,

how do you confirm checkbox choices from a form and post them to a generated email?

form code:
<tr><td>I would like more information about:</td> <td>&nbsp;</td><td>&nbsp;</td></tr> <tr><td><input type="checkbox" id="adcomtrain" name="adcomtrain" value="no" tabindex="1"> Adaptive computer training</td> <td>&nbsp;</td><td>&nbsp;</td></tr> <tr><td><input type="checkbox" id="blindskills" name="blindskills" value="no" tabindex="1"> Accomplish tasks without vision</td> <td>&nbsp;</td><td>&nbsp;</td></tr>

php code:
   $adcomtrain = $_POST["adcomtrain"];
   $blindskills = $_POST["blindskills"];

email buffer:
$info = "I would like more information about:\n";
if ($adcomtrain=="yes") $info .= "Adaptive computer training \n";
if ($blindskills=="yes") $info .= "Accomplish tasks without vision \n";

Bryan Schulz

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: