When I want to submit a form, the data from the form is submited in a script.php script on a different page, but i want the error message(s) resulted from that script.php file to be displayed on the current page. I cannot figure this out, i tryed using header("Location: url"); in the script.php file but it seems that this works only if the script is not returning anything. I also tryed using
Code: Select all
<?php include_once 'script.php';
echo $msg; ?>
where $msg is the error msg from the script.php but this actually redirects me to the blank page with the name of the script.php.
I can work this out if i put the script in the same page and call action="page.php" but i would like to keep the scripts separate from HTML. If there is a way for doing this, please tell me or show me how to do it.
Regards.