I am trying to write a multi-page form that submits data to a MySQL table. The first form, the user logs in and a cookie is set. It then prints a form where they select a state and record type to submit. After they hit the submit button, it prints the appproriate form, according to state and record type selected. Everything works fine up until this point. This last form is itself a multi-part form, as the user can upload a photo if they want. The problem I'm having is that when the form is filled out w/o a photo to upload, and the form is submitted, for some reason the value associated with the submit button isn't working. Here's the relevant code. Can anyone help me figure out why this form isn't working??
From form.php (prints the form)
<form action="<?=$PHP_SELF?>" enctype="multipart/form-data" method="post">
form stuff...blah blah blah
<input type="submit" name="action" value="Preview"> <input type="submit" name="action" value="Add Record!"> <input type="reset">
</form>
From post.php (adds records to the database):
if (!isset ($_COOKIE["Logged"])) {
include('logme.php');
}
else {
if (isset ($action)) {
if ($action == "Next") {
switch ($type) {
case D:
include('death_form.php');
break;
case M:
include ('marriage_form.php');
break;
case B:
include ('birth_form.php');
break;
}
}
if ($action == "Add Record!") {
switch ($type) {
case D:
include('insert_d_record.php');
break;
case M:
include ('insert_m_record.php');
break;
case B:
include ('insert_b_record.php');
break;
}
}
}