Errore in script creando il form

kamranis1

Nuovo Utente
6 Feb 2014
7
0
0
Salve
ho creato questo form pero nel localhost e su server se provo mi da errore undefine line 47 to 57
mi potete aiutare dove ho sbagliato??

<?php

//clean white spaces and special charter from values

function cleanStr($str) {
$cStr = trim($str);
$cStr = htmlspecialchars($cStr);
$cStr = addslashes($cStr);
return $cStr;
}
//check for empty values
function emptyFields($ar) {
if(!is_array($ar)) {
print "This argument must be an array";
return false;

}
//loop through each field and check for empty
foreach($ar as $key => $value) {
if(empty($value)) {
print "<b>" . ucword($key) . "</b>
must not be empty.Please click the browser
back button and correct it.";
return false;
}
}
return true;
}
//calling function to check any empty value
if(!emptyFields($_POST)) {
exit();
}
//check required skills and age
function isEligible($skills,$age) {
$age = intval($age);
if(count($skills) ==0) {
print("You dont have any skill");
return false;
}
if($age < 23 || $age > 35 ) {
print("Your age must betwen 23 and 35");
return false;
}
return true;
}
//assigning field values to variables
$name = cleanStr($_POST['name']);
$phone = cleanStr($_POST['phone']);
$email = cleanStr($_POST['email']);
$address = cleanStr($_POST['address']);
$gender = $_POST['gender'];
$city = $_POST['city'];
$age = (int) cleanStr($_POST['age']);
$skills = $_POST['skills'];
//calling function to check
# that the candidate is eligable for appling to this job
if(!isEligibile($skills,$age)) {
exit();
}
//if everything is ok
print "<h4> Thank You". $name .
"for you intrest in this job.We Will contact you soon</h4>";
print "We recevived the following information about you. <br>";
//printing user submited information
print "Name: " . $name . "<br>";
print "Phone: " . $phone . "<br>";
print "Email: " . $email . "<br>";
print "Address: " . $address . "<br>";
print "Gender: " . $gender . "<br>";
print "City:" . $city ."<br>";
print "Age: " . $age . "<br>";
print "Your skills: " ;
foreach($skills as $value) {
print $value .",";
}

?>
 

Discussioni simili