Hi
I have recently moved hosting companies and an error has come up on this particular page. It says that there maybe a coding error?
I realise that PHP has moved on since this page was created, but was wondering if anyone can help?
Here is the code, can anyone see if there are any errors and possibly point me to somewhere I can fix it.
Kind regards
Phil
<?php require_once('../Connections/phcleani_forms.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
$insertSQL = sprintf("INSERT INTO applicants (mr, name, address, county, post_code, email, phone, mobile, ni, dob, nationality, other_jobs, hours, `position`, town, transport, reference, contact_number, what_work, reference_2, phone_number_2, add_info, keep_details, date_registered) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NOW() )",
GetSQLValueString($_POST['mr'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['county'], "text"),
GetSQLValueString($_POST['post_code'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['ni'], "text"),
GetSQLValueString($_POST['dob'], "text"),
GetSQLValueString($_POST['nationality'], "text"),
GetSQLValueString($_POST['other_jobs'], "text"),
GetSQLValueString($_POST['hours'], "text"),
GetSQLValueString($_POST['position'], "text"),
GetSQLValueString($_POST['town'], "text"),
GetSQLValueString($_POST['transport'], "text"),
GetSQLValueString($_POST['reference'], "text"),
GetSQLValueString($_POST['contact_number'], "text"),
GetSQLValueString($_POST['what_work'], "text"),
GetSQLValueString($_POST['reference_2'], "text"),
GetSQLValueString($_POST['phone_number_2'], "text"),
GetSQLValueString($_POST['add_info'], "text"),
GetSQLValueString($_POST['keep_details'], "text"));
mysql_select_db($database_phcleani_forms, $phcleani_forms);
$Result1 = mysql_query($insertSQL, $phcleani_forms) or die(mysql_error());
$insertGoTo = "thank_you.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
$to = $_POST['email'];
$message = "Your form has been submitted. Thank you";
$subject = 'Application Form Submission';
$headers .= 'From: jobs@phcleaning.co.uk' . "\r\n";
$headers .= 'bcc: info@phcleaning.co.uk';
// Mail it
mail($to, $subject, $message, $headers);
header(sprintf("Location: %s", $insertGoTo));
exit();
}
mysql_select_db($database_phcleani_forms, $phcleani_forms);
$query_Recordset1 = "SELECT * FROM applicants";
$Recordset1 = mysql_query($query_Recordset1, $phcleani_forms) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../phnew.css" rel="stylesheet" type="text/css">
<title>Application Form</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form">
<p align="center" class="style1">Please fill in all fields </p>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>Title:</td>
<td><select name="mr" id="mr">
<option value="Mr" selected>Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Ms">Ms</option>
</select></td>
</tr>
<tr>
<td>Full Name: </td>
<td><input name="name" type="text" id="name" size="50" maxlength="250"></td>
</tr>
<tr>
<td valign="top">Address:</td>
<td><textarea name="address" cols="50" id="address"></textarea></td>
</tr>
<tr>
<td>Post Code:</td>
<td><input name="post_code" type="text" id="post_code"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td>Phone:</td>
<td><input name="phone" type="text" id="phone" size="30"></td>
</tr>
<tr>
<td>Date of Birth: </td>
<td><input name="dob" type="text" id="dob"></td>
</tr>
<tr>
<td>Currently Employed? </td>
<td><select name="other_jobs" id="other_jobs">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select></td>
</tr>
<tr>
<td>How many hours do you work now per week? </td>
<td><input name="hours" type="text" id="hours" size="10" maxlength="2"></td>
</tr>
<tr>
<td>Do you have your own transport?</td>
<td><select name="transport" id="transport">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select></td>
</tr>
<tr>
<td valign="top"><p>Please provide details of at least one<br> employment reference who could support your application. </p>
</td>
<td><textarea name="reference" cols="30" rows="4" id="reference"></textarea></td>
</tr>
<tr>
<td valign="top">Phone Number: </td>
<td><input name="contact_number" type="text" id="contact_number" size="30"></td>
</tr>
<tr>
<td valign="top">What work did you do for this person? </td>
<td><textarea name="what_work" cols="30" rows="4" id="what_work"></textarea></td>
</tr>
<tr>
<td valign="top">Additional information. </td>
<td><textarea name="add_info" cols="30" rows="4" id="add_info"></textarea></td>
</tr>
<tr>
<td valign="top"><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Reset" value="Reset"></td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<input type="hidden" name="MM_insert" value="form">
</form></body></html>
<?php
mysql_free_result($Recordset1);
?>