Php validation with redirect

Hi guys,

I was wondering if there’s a way when a user clicks on a submit button on a form, it would validate the fields then if all fields are filled out, it would redirect to another page. I have been searching and trying different scripts but it doesn’t work…I figured you guys could help me out on this one…

p.s i tried to search it here as well but haven’t find answers yet

Thanks in advance… :slight_smile:


<?php
## processform.php

if ($_POST['inputfield1'] == "validation") {
    header("Location: /validated.php");
} else {
    header("Location: /invalid.php");
}
?>

i’ll try that…thanks!

It’s also good practice to use the exit function when using the header function to redirect.


header("Location: /validated.php");
exit;