Ok so i have this form and it’s just returning a random 500 error… HELP!
this is the submission form
Form Test label,a { font-family : Arial, Helvetica, sans-serif; font-size : 12px; }Business Name:
Name:
Phone Number:
Email Address:
Website:
Which Service(s) are you interested in?:
Review Audit/Management Logo Creation/Editing Website Creation/EditingAdditional Comments:
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$bname=$_POST['fname'];
$name=$_POST['rname'];
$email=$_POST['email'];
$pnum=$_POST['pnum'];
$website=$_POST['website'];
$service = implode(',', $_POST['service']);
$comment=$_POST['comment'];
$sql = "INSERT INTO brp_requests (bname, rname, email, pnum, website, service, comment)
VALUES ($bname, $name, $email, $pnum, $website, $service, $comment)";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
//done. redirect to thank-you page.
header('Location: thank-you.html');
// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>