Hello! Every time I run the script below in my browser I get this:
Here is my script:
Any ideas what is causing the error? The array must be initialized to empty.
Code:
Warning: array_push() [function.array-push]: First argument should be an array in C:\Documents and Settings\Administrator\My Documents\Cyber Safe Deposit\website\signup\join.php on line 16
Warning: array_push() [function.array-push]: First argument should be an array in C:\Documents and Settings\Administrator\My Documents\Cyber Safe Deposit\website\signup\join.php on line 24
Warning: array_push() [function.array-push]: First argument should be an array in C:\Documents and Settings\Administrator\My Documents\Cyber Safe Deposit\website\signup\join.php on line 28
Warning: array_push() [function.array-push]: First argument should be an array in C:\Documents and Settings\Administrator\My Documents\Cyber Safe Deposit\website\signup\join.php on line 32
Here is my script:
Code:
$username=$_REQUEST["username"];
$password=md5($_REQUEST["pass"]);
$passverify=md5($_REQUEST["pass2"]);
$email=$_REQUEST["email"];
$month=$_REQUEST["month"];
$year=$_REQUEST["year"];
$terms=$_REQUEST["terms"];
$error=array();
function getValidationValue() {
$iserror=false;
if(!isset($username, $password, $email, $month, $year)) {
array_push($error, "All fields are required. Please try again.");
$iserror=true;
}
if($password!=$passverify) {
array_push($error, "The two passwords you entered do not match. Please check and try again.");
$iserror=true;
}
if($terms!="accepted") {
array_push($error, "You must accept the terms and conditions to sign up.");
$iserror=true;
}
if($month<1 or $month>12) {
array_push($error, "The month supplied is not valid. Please do not tamper with our forms.");
$iserror=true;
}
if($year<1900 or $year>1995) {
array_push($error, "The year supplied is not valid. Please do not tamper with our forms.");
$iserror=true;
}
if($iserror==true) {
catchError();
}
elseif($iserror=false) {
insertValues;
}
}
function catchError() {
echo "<p>There were problems with the values you supplied: <ul>";
foreach($error as $value) {
echo "<li>Error:" .$value. "</li>";
}
echo "</ul></p>";
}