version | wrong | 404 | modify | email | checks
Q: The script doesn't work. What's happening?
A: Be sure your website is running PHP 4.1 or later. A quick way to verify that is to go to Netcraft and use the "What's that site running?" feature to find out what your server is running. A more robust route is to create a test page to run the phpinfo() function.
Q: Yeah, I'm running PHP 4. The script doesn't
work. What's wrong?
A: Have you made significant customizations to the script? It's fine to make changes, but first get the script working in its simple form. Put the "perfect.php" file in the same folder as your HTML file. After you have the simple case working, go ahead and add customizations and move things around.
Q: Why do I get a page not found (404) error when I click submit?
A: The "perfect.php" file must be accessible to your browser. You can test this by opening the URL to your PHP file in your browser. For example, if the URL for your HTML file is http://www.yourdomain.com/xyz/contact.html and the action for its form is perfect.php, then test by opening http://www.yourdomain.com/xyz/perfect.php in your browser. You should immediately be redirected to the thank you page.
Q: What's with this "Cannot modify header information - headers
already sent..." warning?
A: This error is almost always the result of a previous error. A prior error, like forgetting the ";" at the end of a PHP line, caused PHP to send out a web page displaying an error message, and that web page has a header. The "header()" command at the end of the PERFECT script then fails because a header has already been sent even though the problem is not with the "header()" command itself.
Q: The "Thank Your" page shows up correctly, but I don't get any
A: If the PERFECT script properly redirects you to the confirmation web page but fails to send an email, try replacing the the line:
mail($sendTo, $subjectLine, $msgBody, "From: $sendFrom");
mail($sendTo, $subjectLine, $msgBody);
If that doesn't work, your server is probably configured to block the "mail()" function (see: The PHP Group and SMTP). Ask your web hosting company if they allow PHP mail.
Q: Why does PERFECT only return information for one checkbox?
A: If a web form has multiple checkboxes, users can select each checkbox individually. However, no more than one value is returned if the checkboxes all have the same name. For PERFECT to properly report all the options selected by the user, each option must have a different name. For example:
<label><input type=checkbox name=cat>Cat</label>
<label><input type=checkbox name=dog>Dog</label>
The above checkboxes work because the values given for each of the "name" attributes are unique.