What i'm trying to do is put a bunch of returns from some validation functions i have made into an array. They will either be true or false and i want it to look through the array and if it sees the return of false i want it to fail, and if all return true i want it to write to the DB. My head hurts to much for me to figure it out. Il go to bed.<?php
include_once 'connect.php';
include 'functions.php';
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
<?php
$forename = $_POST['forename'];
$surname = $_POST['surname'];
$title = $_POST['title'];
$road = $_POST['road'];
$district = $_POST['district'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$hometel = $_POST['hometel'];
$mobtel = $_POST['mobtel'];
$email = $_POST['email'];
$pref = $_POST['pref'];
$vforename = checkTextRequired ($forename);
$vsurname = checkTextRequired ($surname);
$vtown = checkTextRequired ($town);
$vtitle = checkTextUnrequired ($title);
$vcounty = checkTextUnrequired ($county);
$vpostcode = checkPostcode ($postcode);
$vhometel = checkPhonenum ($hometel);
$vmobtel = checkPhonenum ($mobtel);
$vemail = checkEmail ($email);
$validate_array = array("$vforename", "$vsurname", "$vtitle", "$vtown", "$vcounty", "$vpostcode", "$vhometel", "$vmobtel", "$vemail");
$loop = 0;
while ( $loop < 9 ) {
$return == $validate_array[$loop];
if ( $return == true ) {
$loop = ($loop + 1);
}else{
echo "You have entered invalid data.";
exit;
}
}
$SQL = "INSERT into customers (forename , surname , title , road , district , town , county , postcode , hometel , mobtel , email , pref) VALUES ('$forename','$surname','$title' ,'$road' ,'$district' ,'$town' ,'$county' ,'$postcode' ,'$hometel' ,'mobtel' ,'$email' ,'$pref')";
mysql_query($SQL) or die("could not register");
print "Thank you for registering!";
echo " <A href='customers.php'>Customers...</a><br>";
?>
EDIT
I should also say what is happening at the moment......... might help.
It seems to completely ignore the validation, even when i know that i particular function will return false...
Fffffuuuuuuu.