Forum Moderators: coopster
sign_up.php
<form action="signup_processor.php" method="post">
<!--form input here -->
<input type="submit" />
signup_processor.php
<?php
if(array_key_exists("submit", $_POST) {
//page validation, make sure the form is coming from the accepted pages only
$username = trim($_POST['username']);
//other input cleaning code would be here
//now we connect to the database and look for a row with the same user name and put the results into an array called $numRows
if($nubRows) {
$error[] = "Username already in use, please pick a diffrent name"
header( "Location: sign_up.php&errors=". $error .);
exit;
}
else {
//script continues processing
Okay so my question is, how do I get the $error array BACK from 'signup_processor.php' without using the above method? the above method *works* but it is very messy, especially when you have a form with 10+ fields in it. I'm working to upgrade a CMS that does this EVERYWHERE. It also poses a problem because all the error messages are printed out row by row above the form were ideally I would like to put a specific error message above the input field that it pertains to.
Any suggestions would be great, I can't really find any method besides the one I mentioned or using JavaScript which is not feasible for a CMS that has 20+ forms that are being validated with the above example.