KillaH425
08-14-2007, 06:12 PM
Hi,
I've been spending the last few hours trying to figure out why my simple include won't work. It is a bunch of functions, and it isn't improperly written, and no errors are given. I am trying to make a multidimensional array by using validation functions and outputting the appended array so that I can call the multidimensional array full of errors to display them. Here's the code:
include (sample function, not necessary to list them all):
function checkAddress($address, &$errors) {
if (strlen($address) < 4)
$errors[] = array("address","Please enter your address!");
}
actual script:
error_reporting(E_ALL);
include('include.php');
if (isset($_POST['submit'])) {
$firstname = $_POST['firstName'];
$lastname = $_POST['lastName'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipCode'];
$country = $_POST['country'];
$cardnumber = $_POST['cardNumber'];
$cardtype = $_POST['cardType'];
$expmonth = $_POST['expMonth'];
$expyear = $_POST['expYear'];
$cvv2code = $_POST['cvv2code'];
$amount = $_POST['amount'];
$errors = array();
checkFirstName($firstname, $errors);
checkLastName($lastname, $errors);
checkAddress($address, $errors);
checkCity($city, $errors);
checkCountryAndState($state, $country, $errors);
checkZipCode($zipcode, $country, $errors);
checkCVV2($cvv2code, $errors);
checkAmount($amount, $errors);
checkCardType($cardtype, $errors);
checkCardNumber($cardnumber, $errors);
print_r($errors);
}
...and the screen just goes blank. No code, no nothing, and it has been doing it ever since I made the include. I have tried putting the code in the actual script, and I rewrote the whole thing, and nothing. I don't understand why it doesn't work. Any help is appreciated!
I've been spending the last few hours trying to figure out why my simple include won't work. It is a bunch of functions, and it isn't improperly written, and no errors are given. I am trying to make a multidimensional array by using validation functions and outputting the appended array so that I can call the multidimensional array full of errors to display them. Here's the code:
include (sample function, not necessary to list them all):
function checkAddress($address, &$errors) {
if (strlen($address) < 4)
$errors[] = array("address","Please enter your address!");
}
actual script:
error_reporting(E_ALL);
include('include.php');
if (isset($_POST['submit'])) {
$firstname = $_POST['firstName'];
$lastname = $_POST['lastName'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipCode'];
$country = $_POST['country'];
$cardnumber = $_POST['cardNumber'];
$cardtype = $_POST['cardType'];
$expmonth = $_POST['expMonth'];
$expyear = $_POST['expYear'];
$cvv2code = $_POST['cvv2code'];
$amount = $_POST['amount'];
$errors = array();
checkFirstName($firstname, $errors);
checkLastName($lastname, $errors);
checkAddress($address, $errors);
checkCity($city, $errors);
checkCountryAndState($state, $country, $errors);
checkZipCode($zipcode, $country, $errors);
checkCVV2($cvv2code, $errors);
checkAmount($amount, $errors);
checkCardType($cardtype, $errors);
checkCardNumber($cardnumber, $errors);
print_r($errors);
}
...and the screen just goes blank. No code, no nothing, and it has been doing it ever since I made the include. I have tried putting the code in the actual script, and I rewrote the whole thing, and nothing. I don't understand why it doesn't work. Any help is appreciated!