Re: Maybe an HTML prob?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/29/06, Frank Reichenbacher, Bio-Concepts, Inc. <frank@xxxxxxxxxxx>
wrote:

I am trying to pass the results of a form to a simple php mail() routine.
Everything works except the checkbox, Permission". No matter what state
the
checkbox is in, the php says it is whatever the "value" is set to on the
form. I must not be trying to pull the checkbox state correctly.

I've tried several different means of evaluating $Permission, including
using empty() and isset(), but no matter what, $Permission always returns
whatever value is set in "value" on the form. In the case below, echo
$Permission returns "Yes" whether the box is checked or not.

Here is the relevant code slightly doctored so as not to give a way a site
in early development:

FORM:
<tr>
<td valign="top">
<input type="checkbox" name="Permission" value="Yes" tabindex="12"
checked></td>
<td><font face="Verdana" size="2">I grant permission to include the
       above information on the website</font></td>
</tr>

ACTION:
<?php
$to = $_POST["to"];
$FName = $_POST["FName"];
$MI = $_POST["MI"];
$LName = $_POST["LNAME"];
$Specialty = $_POST["Specialty"];
$Quals = $_POST["Quals"];
$Hospital = $_POST["Hospital"];
$Address1 = $_POST["Address1"];
$Address2 = $_POST["Address2"];
$Address3 = $_POST["Address3"];
$Address4 = $_POST["Address4"];
$Telephone = $_POST["Telephone"];
$Fax = $_POST["Fax"];
$New_First_Email = $_POST["New_First_Email"];
$OldEmail = $_POST["OldEmail"];
$Permission = $_POST["Permission"];
if ($Permission = "Yes") {
       $Permission = "Yes";
}       else {
       $Permission = "No";


Frank,

You are hardcoding $Permission ($_POST["Permission"]) to be "Yes" in your
code:
<input type="checkbox" name="Permission" value="Yes" tabindex="12" checked>

Google "PHP checkbox example"...

An early hit : http://www.globalissa.com/articles/articleCheckbox.php

David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux