i try my best but fail,,,
department.php
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
</head>
<body><pre>
<?php echo $_SESSION['userid'] ?> has Logged In <a href="logout.php"><input type="button" name="Logout" value="Logout" style="width: 62px"/></a>
</pre>
<h2 align="center">Student Clearance Information</h2>
<form action="students_clearance.php" method="post">
<table align="center">
<tr>
<td> Department Name:</td>
<td> <?php
$con=mysql_connect("localhost:3307","root","kust");
if(!$con)
{
die("Some problems occured during making connection with mysql".mysql_error());
}
?>
<?php
$bd_con= mysql_select_db("kustkht",$con);
if(!$bd_con)
{
die("Some problems occured during selecting DataBase from MySQL".mysql_error());
}?>
<?php $userid= $_SESSION['userid'] ?>
<?php $qry1 = mysql_query("select departmentName from department where userid='$userid' "); while ($row = mysql_fetch_array($qry1)) { ?>
<input type="text" name="depart" style="width:224px" readonly="readonly" value='<?php echo $row['departmentName'];?>'>
<?php }
?>
<?php
mysql_close($con)
?>
<!--select name="depart" style="width:228px">
<option>Select Department</option>
<!--?php
$con=mysql_connect("localhost:3307","root","kust");
if(!$con)
{
die("Some problems occured during making connection with mysql".mysql_error());
}
?>
<!--?php
$bd_con= mysql_select_db("kustkht",$con);
if(!$bd_con)
{
die("Some problems occured during selecting DataBase from MySQL".mysql_error());
}
?>
<!--?php $qry1 = mysql_query("select departmentid,departmentName from department order by departmentName ASC "); while ($row = mysql_fetch_array($qry1)) { ?>
<!?php echo ("<option value = '" . $row['departmentid'] . "'>" . $row['departmentName'] . "</option>");?>
<!?php }
?>
<!?php
mysql_close($con)
?-->
</select>
</td>
</tr>
<tr>
<td> Registration No:</td>
<td> <input type="text" name="regno" value="" style="width:224px" />
</td>
</tr>
<tr>
<td> Date:</td>
<td> <input type="text" name=" Date" value="" style="width:224px"/></td>
</tr>
<tr>
<td> Clearance</td>
<td> Yes <input type="radio" name="clearance" value="Yes"/> No <input type="radio" name="clearance" value="No"/></td>
<td> </td>
</tr>
<tr>
<td> Remarks About Clearance: </td>
<td> <textarea name="RemarksClearance" rows="10" cols="50" style="width:224px"></textarea> </td>
</tr>
<tr>
<td>    </td>
<td><input type="submit" value="Submit"/> </td>
</tr>
</table>
</form>
</body>
</html>
StudentClearance.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Departments</title>
</head>
<body>
<?php
$con=mysql_connect("localhost:3307","root","kust");
if(!$con)
{
die("Some problems occured during making connection with mysql".mysql_error());
}
$bd_con= mysql_select_db("kustkht",$con);
if(!$bd_con)
{
die("Some problems occured during selecting DataBase from MySQL".mysql_error());
}
$department=$_POST['Departments'];
$userid=$_POST['UserId'];
$password=$_POST['Password'];
$password2=$_POST['RetypePass'];
if(isset($_POST['submit'])){
$status = "OK";
$msg="";
// department
if ($department==0)
{
$msg=$msg."Select one field.<BR>";
$status= "NOTOK";}
// Email
if (!(eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $userid)))
{
$msg=$msg."Enter valid Email.<BR>";
$status= "NOTOK";
}
if(mysql_num_rows(mysql_query("SELECT userid FROM department WHERE userid = '$userid'"))){
$msg=$msg."Userid already exists. Please try another one<BR>";
$status= "NOTOK";}
// Password min 6 char max 20 char
if (!(eregi('^[A-Za-z0-9!@#$%^&*()_]{6,20}$',$password)))
{
$msg=$msg."Enter valid Password min 6 Chars.<BR>";
$status= "NOTOK";}
// Retype pass
if ( $password <> $password2 ){
$msg=$msg."Both passwords are not matching<BR>";
$status= "NOTOK";}
$qry="INSERT INTO department(departmentName,userid,password) VALUES (' $department','$userid','$password')";
if (!mysql_query($qry,$con)){
?>
<font face='Verdana' size='2' color=red> <?php echo .$msg. ?></font><br><input type='button' value='Retry' onClick='history.go(-1)'>
}
<?php
else{
?>
<font face='Verdana' size='2' color=green><?php echo "Dear Member Of" ." ". $department .","." " . "your form has been submitted !!!";?></font>
<?php}
}
?>
<?php
mysql_close($con)
?>
</body>
</html>
please help me its urgent,,, attachment also there,,, thanks in advance,