Sorry, I couldn't think of a better Subject title.
I'm stuck trying to get the following to work correctly, and maybe I'm mixing apples & oranges somewhere?
A text explanation follows the code:
<?php
ob_start();
session_start();
error_reporting(2039); // Temporary fix
$submit = $_POST['submit'];
$taxrate = $_POST['taxrate'];
$notaxrate = $_POST['notaxrate'];
// $domain = $_SERVER['SERVER_NAME'];
$self = $_SERVER['PHP_SELF'];
if (isset($submit)) {
if (($taxrate == 'info') && ($notaxrate == 'unchecked')){
echo 'Please select a tax area'; // error msg1
} elseif (($taxrate != 'info') && ($notaxrate == 'checked')) {
echo 'Please choose from only one set of options'; // error msg2
} elseif (($taxrate != 'info') && ($notaxrate == 'unchecked')) {
$salestax == $taxrate;
} elseif (($taxrate != 'info') && ($notaxrate == 'checked')) {
$salestax == $notaxrate;
} // END error check, $salestax assignment & move one
header('Location: nextfile.php'); // go to nextfile IF no errors
} // END isset($submit)
?>
<FORM METHOD="POST" ACTION="<?=$self?>">
MY STATE (USA) CUSTOMERS ONLY:<br>
Please Choose SHIP-TO DESTINATION Area<br>
And Then Click The PROCEED Button Below<br>
<SELECT NAME="taxrate" size="1">
<OPTION VALUE="info" SELECTED>--Select SHIP-TO Destination--</OPTION>
<OPTION VALUE=".0825">My Own County</OPTION>
<OPTION VALUE=".0725">All OTHER State Counties</OPTION>
<input type="hidden" name="taxcalc" value="taxrate">
</SELECT>
<br><br>
NON-STATE CUSTOMERS:<br>
Please Check This Box And Then PROCEED<br>
<input name="notaxrate" type="checkbox" value=".00">NON STATE CUSTOMER<br>
<br>
<INPUT name="submit" type="submit" value="PROCEED">
<INPUT name="reset" type="reset" value="Reset Form">
</FORM>
<?php
ob_end_flush();
?>
Here's how it is supposed to work:
Upon Submit:
If user does NOT choose a list option and does NOT check the checkbox: error msg1
If user does choose a list option AND checks the checkbox; error msg2
If user does choose a list option AND does NOT check the checkbox;
$salestax=$salestax (the value of the list option selected)
- If user does NOT choose a list option AND checks the checkbox;
$salestax=$notaxrate (the value of the checkbox option). This must be passed as
'.00' for further processing.
- Final step: go to nextpage.php
Thank you for any help ... I'm getting blue in the face from trying this and that but not seeing it work correctly.