Post Var. Not Getting Passed To Switch Statement
Posted: Mon Mar 22, 2004 10:05 am
I've got the following JS function to handle form cancellations:
And I've got the following cancel button on the form:
And here is my switch statement:
However, I'm getting:

Code: Select all
// function to cancel
function cancel_form(formName) {
alert(formName.name);
formName.submit();
}Code: Select all
<input type="button" name="submitIt" value="Cancel" onclick="return cancel_form(this.form)">Code: Select all
<?php
// begin switch statment to handle POST request
switch ($_POST['submitIt']) {
case 'Cancel': // if it is being cancelled
echo "submitIt is CANCEL";
break; // ---------- end of cancel case ----------
case 'Submit': // if creating a new one
echo "submitIt is SUBMIT";
break; // ---------- end of create case ----------
default:
echo "submitIt is NOTHING";
}
?>upon submittal. What gives? I've read through php.net about switch statements, but nothing seems wrong there.Notice: Undefined index: submitIt in c:\program files\apache group\apache\htdocs\projects\process_customer_suggestion.php on line 42
submitIt is NOTHING