| Current Path : /home/bolconlineco/public_html/coordinator/ |
| Current File : /home/bolconlineco/public_html/coordinator/registerstudent.php |
<?php
ob_start();
session_start();
?>
<?php include('includes/header.php'); ?>
<?php
if(!isset($_SESSION['coordinator']) || $_SESSION['coordinatorrole'] != 2)
{
header("location:../index.php");
exit();
}
?>
<div id="content">
<span class="left"> </span><h2> Coordinator Panel </h2><span class="right"></span>
<div id="frm">
</div>
<div id="data">
<?php
if(isset($_GET['msg']))
{
echo "<h3>".$_GET['msg']."</h3>";
echo "<br>";
}else if(isset($_GET['error']))
{
echo "<h3>This Email is already Registered</h3>";
}
?><?php
if(isset($_POST['add-student']))
{
$studentId = sql_strip($_POST['studentId']);
$title = sql_strip($_POST['title']);
$fname = sql_strip($_POST['fname']);
$lname = sql_strip($_POST['lname']);
$registrationdate = !empty($_POST['registrationdate'])?sql_strip($_POST['registrationdate']):date('Y-m-d') ;
$dob = sql_strip($_POST['dob']);
$phone = sql_strip($_POST['phone']);
$mobile = sql_strip($_POST['mobile']);
$email = sql_strip($_POST['email']);
$address1 = sql_strip($_POST['address1']);
$address2 = sql_strip($_POST['address2']);
$address3 = sql_strip($_POST['address3']);
$city = sql_strip($_POST['city']);
$country = sql_strip($_POST['country']);
$postcode=sql_strip($_POST['postcode']);
$education = sql_strip($_POST['education']);
$jobtitle=sql_strip($_POST['jobtitle']);
$companyname=sql_strip($_POST['companyname']);
$addressline1=sql_strip($_POST['addressline1']);
$addressline2=sql_strip($_POST['addressline2']);
$addressline3=sql_strip($_POST['addressline3']);
$ecity=sql_strip($_POST['ecity']);
$epostcode=sql_strip($_POST['epostcode']);
$ecountry=sql_strip($_POST['ecountry']);
$category=sql_strip($_POST['category']);
@$course=sql_strip($_POST['course']);
$tutor=sql_strip($_POST['tutor']);
// $rollno=mt_rand(1111,9999);
$StudentQuery="select SId from student where rollno='$studentId'";
$StudentQueryResult=mysql_query($StudentQuery) or die(mysql_error());
if(mysql_num_rows($StudentQueryResult) > 0)
{
$msg="This Student Id is already in system";
header("location:registerstudent.php?msg=$msg");
exit();
}else
{
$sql="select SId from student where email='$email'";
$result=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0 )
{
header("location:student.php?error");
exit();
}else{
if(add_student($title,$studentId,$fname,$lname,$registrationdate,$dob,$phone,$mobile,$email,$address1,$address2,$address3,$city,$country,$postcode,$education,$jobtitle,$companyname,$addressline1,$addressline2,$addressline3,$ecity,$epostcode,$ecountry))
{
$query="insert into assigncourse values('','$studentId','$category','$course','$tutor',0)";
$result=mysql_query($query) or die(mysql_error());
$rand=mt_rand(112325,999990);
$pass="ABCD".$rand;
if(add_tutor_info($email,$pass,4))
{
$headers="";
$str="";
// $to="sohail@solutionica.com";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSmail-Priority: High\n";
$headers .= "X-mailer: My mailer\n";
$headers .= 'From: bolc team' . "\r\n";
$subject="Login Information";
$str .= "<p>Your Account has been created:</p>";
$str .= "<p>User name:<b> " . $email . " </b></p>";
$str .= "<p>PassWord:<b> " . $pass . " </b></p>";
$message="<html><body>".$str."</body></html>";
if(mail($email, $subject, $message, $headers))
{
$msg="Student Register Successfully";
header("location:viewstudent.php?msg=$msg");
exit();
}
}
}
}
}
}
?>
<form id="ID" action="" method="post" >
<h3>Personal Details</h3>
<ul class="col" >
<li>
<label for="title"> Title:</label>
<select name="title">
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Mis">Mis</option>
</select>
</li>
<li>
<label for="name"> Student Id:</label>
<input class="validate[required]" type="text" id="name" name="studentId" value="" />
</li>
<li>
<label for="name"> First Name:</label>
<input class="validate[required]" type="text" id="name" name="fname" value="" />
</li>
<li>
<label for="fname"> Last name:</label>
<input class="validate[required]" type="text" id="fname" name="lname" value="" />
</li>
<li>
<label for="fname"> Registration Date:</label>
<input class="" type="text" id="fname" name="registrationdate" value="" />
</li>
<li>
<label for="dob"> Date of birth:</label>
<input class="validate[required,custom[date]]" type="text" id="dob" name="dob" value="" />
</li>
<li>
<label for="mobile"> Phone:</label>
<input class="validate[required],custom[phoneno]" type="text" id="phone" name="phone" value="" />
</li>
<li>
<label for="mobile"> Mobile:</label>
<input class="validate[required],custom[phoneno]" type="text" id="mobile" name="mobile" value="" />
</li>
<li>
<label for="email"> Email:</label>
<input class="validate[required,custom[email]]" type="text" id="email" name="email" value="" />
</li>
</ul>
<ul class="col" >
<li>
<label for="address"> Address line 1:</label>
<input type="text" id="address" value="" class="validate[required]" name="address1" />
</li>
<li>
<label for="address"> Address line 2:</label>
<input type="text" id="address" value="" class="validate[required]" name="address2" />
</li>
<li>
<label for="address"> Address line 3:</label>
<input type="text" id="address" value="" class="validate[required]" name="address3" />
</li>
<li>
<label for="city"> City:</label>
<input type="text" id="city" value="" class="validate[required]" name="city" />
</li>
<li>
<label for="country"> Country:</label>
<input type="text" id="country" name="country" class="validate[required]" value="" />
</li>
<li>
<label for="country"> Post Code:</label>
<input type="text" id="country" name="postcode" class="validate[required]" value="" />
</li>
<li>
<label for="education">Education</label>
<!-- <input class="validate[required]" type="text" name="education" value="" />-->
<textarea name="education" rows="7" cols="30" class="validate[required]"></textarea>
</li>
<li>
</li>
<li>
<!--
<div id="btn">
<input class="clear" type="reset" value="Clear" />
<input class="add" type="submit" name="add-student" value="Add" />
</div>-->
</li>
<li>
</li>
</ul>
<ul class="col" >
<h3> Employment Details</h3>
<li>
<label for="title"> Job Title:</label>
<input type="text" name="jobtitle" />
</li>
<li>
<label for="name"> Company Name:</label>
<input class="" type="text" id="name" name="companyname" value="" />
</li>
<li>
<label for="name"> Address line1:</label>
<input class="" type="text" id="name" name="addressline1" value="" />
</li>
<li>
<label for="fname"> Address line2:</label>
<input class="" type="text" id="" name="addressline2" value="" />
</li>
<li>
<label for="fname"> Address line3:</label>
<input class="" type="text" id="" name="addressline3" value="" />
</li>
</ul>
<ul class="col" style="margin-top:80px;">
<li>
<label for="dob"> City:</label>
<input class="" type="text" id="ecity" name="ecity" value="" />
</li>
<li>
<label for="mobile"> PostCode:</label>
<input class="" type="text" id="epostcode" name="epostcode" value="" />
</li>
<li>
<label for="mobile"> Country:</label>
<input class="" type="text" id="" name="ecountry" value="" />
</li>
<li>
</li>
</ul>
<ul class="col">
<h3>Course Details</h3>
<li>
<label for="">Category</label>
<select name="category" id="category">
<option value="">-- Category --</option>
<?php
$query="select * from category where CategoryStatus=1";
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
?>
<option value="<?php echo $row['CategoryId']; ?>"><?php echo $row['CategoryName'];?></option>
<?php
}
?>
</select>
</li>
<li>
<label for="">Course</label>
<select name="course" id="course" disabled="disabled">
<option value=""></option>
</select>
</li>
<li>
<label>Tutor</label>
<select name="tutor">
<option value="">-- SELECT --</option>
<?php
$query="select * from tutor where tutorstatus=1";
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
extract($row);
?>
<option value="<?php echo $tutorId;?>"><?php echo $firstname.' '.$lastname;?></option>
<?php
}
?>
</select>
</li>
<li>
<div id="btn">
<input class="clear" type="reset" value="Clear" />
<input class="add" type="submit" name="add-student" value="Register" />
</div>
</li>
</ul>
</form>
</div>
</div><!-- end data -->
</div> <!-- end content -->
</div><!-- end wrapper -->
<script language="javascript">
$("document").ready(function(){
var course=$('#course');
$("#category").change(function(){
var categoryId=$(this).val();
$.post('get_courses.php',{id:categoryId},function(data){
course.html(data);
course.removeAttr('disabled');
})
});
});
</script>
<!--
<script language="javascript">
$("document").ready(function(){
var course=$('#data');
$("#course").change(function(){
var courseId=$(this).val();
$.post('studentbycourse.php',{id:courseId},function(data){
course.html(data);
course.removeAttr('disabled');
})
});
});
</script> -->
<?php include('../includes/footer.php');?>