Usage of missing_fields_redirect

5 replies
Joined: 01/11/2007
User offline. Last seen 1 year 49 weeks ago.

Below is some simple code I want to try for the missing_fields_redirect option. The website gives virtually no information of how to make use of this value, outside of the fact that it can redirect to a user created error page. I am beginning to assume it is designed for a static page? Which would be useless if you can't tell people what is missing. But for instance, if a field fails a regex check, the default error page doesn't tell you any information at all. So, I want to write my own script to handle the error checking. If this fails, I suppose I could hard code the error page into Formmail.php, but I want to avoid changing the script itself to make upgrades easier later. Here's some code (using just one field), but it completely bombs out, doesn't echo out anything at all. What is the problem?

***SEE UPDATED CODE BELOW***

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 01/11/2007
User offline. Last seen 1 year 49 weeks ago.

[nevermind]

Joined: 01/11/2007
User offline. Last seen 1 year 49 weeks ago.

Well, I appear to be somewhat wrong. Apparently it sort of works. The page works with respect to the condition, but the condition is true regardless.

So, now I have a situation where it goes to the error page no matter what, whether the form is correct or not. And I still apparently can't grab the fields by their normal names to check them. Help!

Updated code:

<?php
echo "Getting form errors...";

$fname = $_POST["firstname"];
$lname = $_POST["lastname"];

echo "Variable retrieved...
";

if ($fname != NULL) {
echo "First Name cannot be left blank.";
}

if ($lname != NULL) {
echo "Last Name cannot be left blank.";
}

echo "
All form errors report.";
?>

Joined: 01/11/2007
User offline. Last seen 1 year 49 weeks ago.

Basically I just need to know how formmail.php handles the errors if you set up the missing_fields_redirect so that my script can address it. I tried accessing fields via their names and via the $errors[] array, but neither seemed to work.

Joined: 06/04/2007
User offline. Last seen 10 hours 45 min ago.

Have you tried $_GET instead of $_POST?

http://www.boaddrink.com/projects/phpformmail/readme.htm#redirect_values

-Andrew Riley

Joined: 01/11/2007
User offline. Last seen 1 year 49 weeks ago.

Yes, but of course that makes for a rather sloppy URL with a big form. Ultimately what I did was alias everything, and then manipulate the default formmail.php error page to include my template. That seems to have made everyone happy.

User login