Not sure whether to post this under PHP or WINDOWS. I'm guessing PHP.
I am running XP so I cannot verify this.
I am a volunteer for my small town's board of health. I created an online sign-up form where other townspeople can volunteer. The form is method="post" with action="#result" and uses php to determine whether to render the "signup" version of the page (the signup form) or the "confirmation" version of the page (thank you for volunteering, etc.), after sending the volunteer information to the proper folks using php mail().
It has worked perfectly for everyone I have asked to test the form, except for the actual health agent and his secretary in the town hall! They are not exactly what one would call computer literate, but (over the phone) I talked them through filling out and submitting the form TWICE, and I believe they did it correctly. When I asked them what kind of computer they're using, they said "brand new! the newest ones in the building!" so that tells me they're probably running Vista, since no one in the town hall would know how to reload with xp. That's the only difference I can think of between the "it works" test group and the "it doesn't work" test group.
What happens when the Vista group submits the correctly filled out form:
(1) NO error message ($errmsg) is displayed, and NO form labels or input fields are highlighted.
(2) The "signup" version of the page is rendered again instead of the "confirmation" version, which means this statement is FALSE:
if (!$errors && isset($_POST['submit']))
(3) The "signupform" still has all of the entries filled in, which means the $_POST variables were read.
(4) NO emails were received.
I can no longer test the form b/c it has gone live. The information entered would be sent to the town board of health and the head of the steering committee. But I would still like to figure out why it only works for xp and mac folks, and not for vista.
A summary of my PHP Version 4.4.4 code:
Code:
<?php
:
:
:
if (isset($_POST['submit'])) {
/*-- Load Post Variables --*/
if (isset($_POST['firstname'])) {
$firstname = $_POST['firstname'];
}
if (isset($_POST['lastname'])) {
$lastname = $_POST['lastname'];
}
/*-- Validate Required Fields --*/
if (!$firstname) {$errors['firstname'] = 1;}
if (!$lastname) {$errors['lastname'] = 1;}
if ($errors) {$errmsg = "Please correct errors highlighted in pink.";}
}
/*-- Format Messages --*/
if (!$errors && isset($_POST['submit'])) {
/* format $confirmation message */
/* format $newvolunteer message */
}
/*-- Send Emails --*/
if (!$errors && isset($_POST['submit'])) {
/* send emails */
}
:
:
:
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
:
:
<?php if (!$errmsg && isset($_POST["submit"])) : ?>
<div id="result">
<h2>Thank You</h2>
<p class="center bold">If you provided an email address, you should receive the following confirmation shortly:</p>
<p><?php echo nl2br($confirmation); ?></p>
</div><!-- end result -->
<?php else : ?>
<div id="signup">
<h2>Volunteers Needed</h2>
:
:
<form name="signupform" method="post" action="#result">
<?php if ($errmsg) : ?>
<div id="result">
<div id="errmsg"><?php echo $errmsg; ?></div>
<?php endif; ?>
:
:
<th class="r<?php if ($errors['firstname']) {echo " e";} ?>">First Name:</th>
<td><input <?php if ($errors['firstname']) {echo "class=\"e\" ";} ?>type="text" name="firstname" <?php if ($firstname) { echo "value=\"$firstname\" "; } ?>/></td>
<th class="r<?php if ($errors['lastname']) {echo " e";} ?>">Last Name:</th>
<td><input <?php if ($errors['lastname']) {echo "class=\"e\" ";} ?>type="text" name="lastname" <?php if ($lastname) { echo "value=\"$lastname\" "; } ?>/></td>
:
:
<?php if ($errmsg) : ?>
</div><!-- end result -->
<?php endif; ?>
:
:
</div><--end signup-->
:
:
Thanks in advance!