bolformadd

Home / bolformadd




Boxes of Love 2018


connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$PickUpSite = $_POST['PickUpSite'];
$FirstName = mysqli_real_escape_string($conn, $_POST['FirstName']);
$LastName = mysqli_real_escape_string($conn, $_POST['LastName']);
$HouseNo = $_POST['HouseNo'];
$Street = $_POST['Street'];
$Apt = $_POST['Apt'];
$City = $_POST['City'];
$State = $_POST['State'];
$PostalCode = $_POST['PostalCode'];
$Ethnicity = $_POST['Ethnicity'];
$HomePhone = $_POST['HomePhone'];
$AltPhone = $_POST['AltPhone'];
$Gender = $_POST['Gender'];
$DOB = $_POST['DOB'];

//list($m, $d, $y) = explode("/", $conn, $_POST["DOB"]);
//$nDOB = $y."/".$m."/".$d;

$NumberInHousehold = $_POST['NumberInHousehold'];
$ChildrenOver17 = $_POST['ChildrenOver17'];
$HouseholdType = $_POST['HouseholdType'];
$Language = $_POST['Language'];
$Interpreter = isset($_POST['Interpreter'])?1:0;

$pickedup = isset($_POST['pickedup'])?1:0;
$pickedupat = $_POST['pickedupat'];

$Notes = $_POST['Notes'];

list($m, $d, $y) = explode("/", $_POST["pickedupon"]);
$npickedupon = $y."/".$m."/".$d;

$pin = $_POST['pin'];

$baduser = 0;

//Check for blank fields
if ($FirstName == "" ||$LastName == "")
{
echo "

You must enter a first and last name on every record.
This record has not been processed. Please hit back in your browser and try again.

\n";
echo "


"; echo "
Return to Home

\n";
$baduser = 1;
}
else
if (($pin != "1739")&&($pin != "0310")&&($pin != "9635")&&($pin != "6164")&&($pin != "7041")&&($pin != "6811")&&($pin != "2893")&&($pin != "4102")&&($pin != "5883")&&($pin != "9203")&&($pin != "2985")&&($pin != "3674")&&($pin != "8603")&&($pin != "9961")&&($pin != "5317")&&($pin != "7289")&&($pin != "9260")&&($pin != "3092")&&($pin != "4495")&&($pin != "6409")&&($pin != "0721")&&($pin != "1196")&&($pin != "9402")&&($pin != "9398")&&($pin != "9370")&&($pin != "4052"))
{
echo "

The pin number you have entered is not correct.

\n";
}
else

if ($baduser != 1)

{

//Everything passed, enter info in database
$query = "INSERT into BoxesofLove.Toys4TotsList (pickedup, pickedupon, pickedupat, FirstName, LastName, HouseNo, Street, Apt, Language, Interpreter, City, State, PostalCode, HomePhone, AltPhone, PickUpSite, pickalt, NumberInHousehold, ChildrenOver17, Ethnicity, HouseholdType, DOB, Gender, Notes, pin) VALUES ('$pickedup', '$npickedupon', '$pickedupat','$FirstName', '$LastName', '$HouseNo', '$Street', '$Apt', '$Language', '$Interpreter', '$City', '$State', '$PostalCode', '$HomePhone', '$AltPhone', '$PickUpSite', '$PickUpSite', '$NumberInHousehold', '$ChildrenOver17', '$Ethnicity', '$HouseholdType', '$DOB', '$Gender', '$Notes', '$pin')";
}

if (!mysqli_query($conn,$query)) {
die('Error: ' . mysqli_error($conn));
}

usleep(2000000);

$childCounter = $_POST['childCounter'];
$insert_Toys4TotsList_id = mysqli_insert_id($conn);
$parentName = $FirstName . " " . $LastName;

for ($i=1; $i<$childCounter; $i++){ $ChildFName = mysqli_real_escape_string($conn, $_POST['ChildFName_'.$i]); $ChildLName = mysqli_real_escape_string($conn, $_POST['ChildLName_'.$i]); list($m, $d, $y) = explode("/", $_POST["ChildDOB_".$i]); $nChildDOB = $y."-".$m."-".$d; //$ChildDOB = $_POST['ChildDOB_'.$i]; $ChildGender = strtoupper(trim($_POST['ChildGender_'.$i])); $Age = $_POST['Age_'.$i]; $ShowedId = isset($conn, $_POST['ShowedId_'.$i])?1:0; if (empty($ChildFName) && empty($ChildLName) && empty($ChildDOB) && empty($ChildGender) && empty($Age)) {} else { $query = "INSERT into BoxesofLove.Children VALUES('','$ChildFName','$ChildLName','$nChildDOB','$ChildGender','$Age','$ShowedId','$insert_Toys4TotsList_id', '$parentName')"; } if (!mysqli_query($conn, $query)) { die('Error: ' . mysqli_error($conn)); }} $AdultCounter = $_POST['AdultCounter']; $parentName = $FirstName . " " . $LastName; $nid = mysqli_real_escape_string($conn, $insert_Toys4TotsList_id); for ($i=1; $i<$AdultCounter; $i++) { $AdultFName = mysqli_real_escape_string($conn, $_POST['AdultFName_'.$i]); $AdultLName = mysqli_real_escape_string($conn, $_POST['AdultLName_'.$i]); list($m, $d, $y) = explode("/", $_POST["AdultDOB_".$i]); $nAdultDOB = $y."-".$m."-".$d; //$AdultDOB = $_POST['AdultDOB_'.$i]; $AdultGender = strtoupper(trim($_POST['AdultGender_'.$i])); if (empty($AdultFName) && empty($AdultLName) && empty($AdultDOB) && empty($AdultGender)) { //do nothing, empty record } else { // insert new records if there is no childID (assigned after insert) $query = "INSERT into BoxesofLove.OtherAdults VALUES ('','$AdultFName','$AdultLName','$nAdultDOB','$AdultGender','$nid','$parentName')"; if (!mysqli_query($conn, $query)) { die('Error: ' . mysqli_error($conn)); } } $AdultFName = ""; $AdultLName = ""; $AdultDOB = ""; $AdultGender = ""; } if (!mysqli_query($conn,$query)) { die('Error: ' . mysqli_error($conn)); } else { echo "

$FirstName $LastName has been entered into the database!

\n";
echo "

Add Record

\n";
}

?>