Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics

Dashboard
Notifications
Mark all as read
Q&A

Backendly redirecting a user from a contact form webpage to a success webpage

+1
−0

On a CentOS Apache-MySQL-PHP environment I have a website with a simple HTML-PHP-CSS contact form; the contact form itself is working.

This is how I backendly redirect a user from the contact form webpage to a success message webpage after a successful submission, based on the built-in W3C-developed-behavior of the form's HTML structures:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Location: URL_COMES_HERE');
    exit;
}

Would you suggest to improve this code somehow? Maybe I lacked some validations.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment

No time for a full answer, so just a comment: I do the same sort of thing, but in the first program, that is, inside the if() statement, I add: validation of input, preprocessing of the data (if appropriate) - that way, if the form is bad (e.g., client-side validation insufficient and/or bypassed), the original form can be redisplayed easily rather than bouncing to the destination and then back. manassehkatz‭ 2 days ago

0 answers

Sign up to answer this question »