<?php
// connect to the database
include('connect-db.php');
// check if the form has been submitted. If it has, start to process the form and save it to the database
if (isset($_POST['submit']))
{
// get form data, making sure it is valid
$employeeno = mysql_real_escape_string(htmlspecialchars($_POST['txtempno']));
$employeename = mysql_real_escape_string(htmlspecialchars($_POST['txtempname']));
$position = mysql_real_escape_string(htmlspecialchars($_POST['txtpos']));
$salary = mysql_real_escape_string(htmlspecialchars($_POST['txtsal']));
$allottee = mysql_real_escape_string(htmlspecialchars($_POST['txtaname']));
$address = mysql_real_escape_string(htmlspecialchars($_POST['address']));
$relation = mysql_real_escape_string(htmlspecialchars($_POST['txtremp']));
$age = mysql_real_escape_string(htmlspecialchars($_POST['txtage']));
// check to make sure both fields are entered
if ($firstname == '' || $lastname == '' ||$position=='' ||$salary=='' || $allottee=='' || $address=='' ||$relation=='' || $age=='')
{
// generate error message
$error = 'ERROR: Please fill in all required fields!';
// if either field is blank, display the form again
renderForm($employeeno, $employeename, $position, $salary,$allottee,$address,$relation,$age, $error);
}
else
{
// save the data to the database
mysql_query("INSERT profiles SET employee no='$employeeno', employee name='$employeename', position='$position', salary='$salary', allottee name='$allottee', address='$address', relation='$relation', age='$age'")
or die(mysql_error());
// once saved, redirect back to the view page
header("Location: admin_record2.php");
}
}
else
// if the form hasn't been submitted, display the form
{
renderForm('','','');
}
?>
Kindly help me, in the closing tag of php "?>" it displays "Unexpected $end". Thanks