[insert_php] $con = mysqli_connect(“localhost”,”surendr_srnday”,”3-nt=S6Aq#e7″,”surendr_srnday”);
$errflg=0;
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data=htmlspecialchars($data,ENT_QUOTES);
return $data;
}
$collegename=$name1=$name2=$designation1=$designation2=$specialization1=$specialization2=””;
if (isset($_POST[“mysubmit”]))
{

if (empty($_POST[“collegename”])) {
echo “College Name is Mandatory”; $errflg=1;
} else {
$collegename = strtoupper(test_input($_POST[“collegename”]));

if (!preg_match(“/^[a-zA-Z ]*$/”,$name)) {
echo “Only letters and white space allowed”; $errflg=1;
}
}

if (empty($_POST[“name1”])) {
echo “Name is Mandatory”; $errflg=1;
} else {
$name1 = strtoupper(test_input($_POST[“name1”]));

if (!preg_match(“/^[a-zA-Z ]*$/”,$name1)) {
echo “Only letters and white space allowed”; $errflg=1;
}
}

if(empty($_POST[‘designation1’])){
echo “Please Enter Designation”; $errflg=1;
}
else
{$designation1=test_input($_POST[‘designation1’]);}

if(empty($_POST[‘specialization1’])){
echo “Please Enter Specialization”; $errflg=1;
}
else
{$specialization1=test_input($_POST[‘specialization1’]);}

if (!empty($_POST[“name2”]))
{$name2 = strtoupper(test_input($_POST[“name2”]));
if (!preg_match(“/^[a-zA-Z ]*$/”,$name2)) {
echo “Only letters and white space allowed”; $errflg=1;
}
}
if (!empty($_POST[“designation2”]))
{$designation2 = strtoupper(test_input($_POST[“designation2”]));}

if (!empty($_POST[“specialization2”]))
{$specialization2 = strtoupper(test_input($_POST[“specialization2”]));}

if ($errflg==0)
{
$ipsubmitted=$_SERVER[‘REMOTE_ADDR’];
$dtsubmitted=date(“Y-m-d H:i:s”,strtotime(“+330 minutes”));
$qry1=”insert into zooregistration (collegename, name1, designation1, specialization1, name2, designation2, specialization2, dtsubmitted, ipsubmitted)
value (‘$collegename’, ‘$name1’, ‘$designation1’, ‘$specialization1’, ‘$name2’, ‘$designation2’, ‘$specialization2’, ‘$dtsubmitted’, ‘$ipsubmitted’)”;

$qry2=mysqli_query($con, $qry1);

$qryr3=mysqli_insert_id($con);
if (strlen($qryr3)==1) {$applno=’0000′.$qryr3;}
if (strlen($qryr3)==2) {$applno=’000′.$qryr3;}
if (strlen($qryr3)==3) {$applno=’00’.$qryr3;}
if (strlen($qryr3)==4) {$applno=’0′.$qryr3;}
if (strlen($qryr3)==5) {$applno=$qryr3;}
$applno=”SRNZOO18″.$applno;

$updtqry=”update zooregistration set applno=’$applno’ where id=’$qryr3′”;
$qry4=mysqli_query($con, $updtqry) or die(mysqli_error($con));

echo “
Thank your for your Registration. Your Registration NNo. is “.$applno.”“;

}

}

if (!isset($_POST[“mysubmit”]) || $errflg==1)
{

echo ‘

‘;
echo ‘

‘;
echo ‘

Registration Form
College Name
Details of the Teachers (Max 2 per college)
Name
Designation
Specialization
Name
Designation
Specialization

‘;

}

[/insert_php]