<?php

  error_reporting(E_ERROR | E_WARNING | E_PARSE);

	function generateRandomString($length = 10) {
		$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
		$charactersLength = strlen($characters);
		$randomString = '';
		for ($i = 0; $i < $length; $i++) {
			$randomString .= $characters[rand(0, $charactersLength - 1)];
		}
		return $randomString;
	}

$code=generateRandomString();
 
$conn = new mysqli("localhost", "root", "Boom95z", "contractor");
 
$stmt = $conn->prepare("insert into qualifier (code, datestampe) values (?,now())");
$stmt->bind_param("s", $code);
$stmt->execute();
$stmt->close();
 
 $stmt = $conn->prepare("update qualifier set name=? where code=?");$stmt->bind_param("ss", $_POST['name'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set bname=? where code=?");$stmt->bind_param("ss", $_POST['bname'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set abn=? where code=?");$stmt->bind_param("ss", $_POST['abn'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set email=? where code=?");$stmt->bind_param("ss", $_POST['email'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set phone=? where code=?");$stmt->bind_param("ss", $_POST['phone'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set areas=? where code=?");$stmt->bind_param("ss", $_POST['areas'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set mileage=? where code=?");$stmt->bind_param("ss", $_POST['mileage'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set lux=? where code=?");$stmt->bind_param("ss", $_POST['lux'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set license=? where code=?");$stmt->bind_param("ss", $_POST['license'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set solar=? where code=?");$stmt->bind_param("ss", $_POST['solar'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set hvac=? where code=?");$stmt->bind_param("ss", $_POST['hvac'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set wholesalers=? where code=?");$stmt->bind_param("ss", $_POST['wholesalers'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set suppliers =? where code=?");$stmt->bind_param("ss", $_POST['suppliers'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set rateph=? where code=?");$stmt->bind_param("ss", $_POST['rateph'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set plugs=? where code=?");$stmt->bind_param("ss", $_POST['plugs'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set loading=? where code=?");$stmt->bind_param("ss", $_POST['loading'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set loading_we=? where code=?");$stmt->bind_param("ss", $_POST['loading_we'], $code);$stmt->execute();$stmt->close();


$stmt = $conn->prepare("update qualifier set frames=? where code=?");$stmt->bind_param("ss", $_POST['frames'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set smframes=? where code=?");$stmt->bind_param("ss", $_POST['smframes'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set rcframes=? where code=?");$stmt->bind_param("ss", $_POST['rcframes'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set trf_hour=? where code=?");$stmt->bind_param("ss", $_POST['trf_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set trf_recy=? where code=?");$stmt->bind_param("ss", $_POST['trf_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set sm_hour=? where code=?");$stmt->bind_param("ss", $_POST['sm_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set sm_recy=? where code=?");$stmt->bind_param("ss", $_POST['sm_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set susp_hour=? where code=?");$stmt->bind_param("ss", $_POST['susp_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set susp_recy=? where code=?");$stmt->bind_param("ss", $_POST['susp_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set oys_hour=? where code=?");$stmt->bind_param("ss", $_POST['oys_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set oys_recy=? where code=?");$stmt->bind_param("ss", $_POST['oys_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set recs_hour=? where code=?");$stmt->bind_param("ss", $_POST['recs_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set recs_recy=? where code=?");$stmt->bind_param("ss", $_POST['recs_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set hb_hour=? where code=?");$stmt->bind_param("ss", $_POST['hb_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set hb_recy=? where code=?");$stmt->bind_param("ss", $_POST['hb_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set corn_hour=? where code=?");$stmt->bind_param("ss", $_POST['corn_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set corn_recy=? where code=?");$stmt->bind_param("ss", $_POST['corn_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set lb_hour=? where code=?");$stmt->bind_param("ss", $_POST['lb_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set lb_recy=? where code=?");$stmt->bind_param("ss", $_POST['lb_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set fld_hour=? where code=?");$stmt->bind_param("ss", $_POST['fld_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set fld_recy=? where code=?");$stmt->bind_param("ss", $_POST['fld_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set dl_hour=? where code=?");$stmt->bind_param("ss", $_POST['dl_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set dl_recy=? where code=?");$stmt->bind_param("ss", $_POST['dl_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set dlb_hour=? where code=?");$stmt->bind_param("ss", $_POST['dlb_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set dlb_recy=? where code=?");$stmt->bind_param("ss", $_POST['dlb_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set trk_hour=? where code=?");$stmt->bind_param("ss", $_POST['trk_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set trk_recy=? where code=?");$stmt->bind_param("ss", $_POST['trk_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set bnk_hour=? where code=?");$stmt->bind_param("ss", $_POST['bnk_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set bnk_recy=? where code=?");$stmt->bind_param("ss", $_POST['bnk_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set tub_hour=? where code=?");$stmt->bind_param("ss", $_POST['tub_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set tub_recy=? where code=?");$stmt->bind_param("ss", $_POST['tub_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set bulb_hour=? where code=?");$stmt->bind_param("ss", $_POST['bulb_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set bulb_recy=? where code=?");$stmt->bind_param("ss", $_POST['bulb_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set shop_hour=? where code=?");$stmt->bind_param("ss", $_POST['shop_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set shop_recy=? where code=?");$stmt->bind_param("ss", $_POST['shop_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set street_hour=? where code=?");$stmt->bind_param("ss", $_POST['street_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set street_recy=? where code=?");$stmt->bind_param("ss", $_POST['street_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set strip_hour=? where code=?");$stmt->bind_param("ss", $_POST['strip_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set strip_recy=? where code=?");$stmt->bind_param("ss", $_POST['strip_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set oth_hour=? where code=?");$stmt->bind_param("ss", $_POST['oth_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set oth_recy=? where code=?");$stmt->bind_param("ss", $_POST['oth_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set frm_hour=? where code=?");$stmt->bind_param("ss", $_POST['frm_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set frm_recy=? where code=?");$stmt->bind_param("ss", $_POST['frm_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set sensor_hour=? where code=?");$stmt->bind_param("ss", $_POST['sensor_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set sensor_recy=? where code=?");$stmt->bind_param("ss", $_POST['sensor_recy'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set par_hour=? where code=?");$stmt->bind_param("ss", $_POST['par_hour'], $code);$stmt->execute();$stmt->close();
$stmt = $conn->prepare("update qualifier set par_recy=? where code=?");$stmt->bind_param("ss", $_POST['par_recy'], $code);$stmt->execute();$stmt->close();


$id= '';

$sql9 = "select id from qualifier where code='" . $code . "'";

$result = $conn->query($sql9);  
while($row = $result->fetch_assoc()) 
{ 
	$id  = $row['id'];
}


header("Location: contractor-qualifier.php?s=" . $id);


/*
$bname varchar(255),
$abn varchar(255),
$email varchar(255),
phone varchar(255),
areas varchar(255),
mileage varchar(255),
lux varchar(255),
license varchar(255),
solar varchar(255),
hvac varchar(255),
wholesalers varchar(255),
suppliers varchar(255),
rateph varchar(255),
plugs varchar(255),
loading varchar(255),
frames varchar(255),
smframes varchar(255),
rcframes varchar(255),
trf_hour varchar(255),
trf_recy varchar(255),
sm_hour varchar(255),
sm_recy varchar(255),
susp_hour varchar(255),
susp_recy varchar(255),
oys_hour varchar(255),
oys_recy varchar(255),
recs_hour varchar(255),
recs_recy varchar(255),
hb_hour varchar(255),
hb_recy varchar(255),
corn_hour varchar(255),
corn_recy varchar(255),
lb_hour varchar(255),
lb_recy varchar(255),
fld_hour varchar(255),
fld_recy varchar(255),
dl_hour varchar(255),
dl_recy varchar(255),
dlb_hour varchar(255),
dlb_recy varchar(255),
trk_hour varchar(255),
trk_recy varchar(255),
bnk_hour varchar(255),
bnk_recy varchar(255),
tub_hour varchar(255),
tub_recy varchar(255),
bulb_hour varchar(255),
bulb_recy varchar(255),
shop_hour varchar(255),
shop_recy varchar(255),
street_hour varchar(255),
street_recy varchar(255),
strip_hour varchar(255),
strip_recy varchar(255),
oth_hour varchar(255),
oth_recy varchar(255),
frm_hour varchar(255),
frm_recy varchar(255),
sensor_hour varchar(255),
sensor_recy varchar(255),
par_hour varchar(255),
par_recy varchar(255),
datestampe datetime,*/


?>
