Hi guys,
In the below form when a user enters an admission number and click on the relevant type report the report was generated. ..Then I want something like this.When a user enters an admission number which is already existing, a validation should come as "The number already existed". How can i do that?
<form name="form1" method="post" action="certificaterValid.php">
<table width="850" border="1" align="center" bgcolor="#00FFFF">
<tr>
ing="0" cellspacing="0">
<tr>
<td width="25%"><img src="../IMAGE/banner - Copy.jpg" alt="" width="186" height="136" /></td>
<td width="75%" align="center" valign="middle"><div align="center"><img src="../IMAGE/banner.jpg" alt="" width="733" height="137" /></div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="170"> </td>
<td width="664"><table width="657" border="0">
<tr>
<td width="124"><a href="../../Home page/new student registration/add_or_manage.php">Manage Data</a></td>
<td width="124"> </td>
<td width="124"> </td>
Change Password
<td width="129" align="center"><a href="../Home page/new student registration/signout.php">Signout</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="59" valign="top"><ul id="MenuBar1" class="MenuBarVertical">
Add Admin Login
<li><a href="../../Student registration/new student registration/newStudentRegistrationForm.php">Add Student</a></li>
<li><a href="../../student attendance/add attendance/addStudentAttendance.php">Add Student Attendance</a> </li>
<li><a href="../../Student time table/add1 time table/addTimeTable.php">Add Time Table</a></li>
<li><a href="../../Student marks/add student marks/addStudentMark.php">Add Student Marks</a></li>
<li><a href="../../manage subject/add subject.php">Add Subject</a></li>
Search Student Information
<li><a href="../../student payments reports/studentsPayments.php">Student Payment Reports</a></li>
<li><a href="../../Issue certificate/issueCertificate.php">Issue Certificates</a></li>
</ul>
<p> </p>
<p> </p></td>
<td valign="top"><table width="659" border="0">
<tr>
<td> </td>
<td colspan="8"> </td>
</tr>
<tr>
<td width="14"> </td>
<td colspan="8"><h3>
<label>Issue cretificate</label>
</h3></td>
</tr>
<tr>
<td> </td>
<td width="153"> </td>
<td width="3"> </td>
<td width="128"> </td>
<td width="32"> </td>
<td width="60"> </td>
<td width="55"> </td>
<td width="55"> </td>
<td width="66"> </td>
</tr>
<tr>
<td> </td>
<td><label>Admission No</label> </td>
<td> </td>
<td>
<center>
<div >
<input type="text" onkeyup="getScriptPage('box','text_content')" id="text_content" size="40" name="admission_no" />
<div id="box"></div>
</div>
</center> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>Issue Cetificate</label> </td>
<td> </td>
<td>
<select name="report" id="jumpMenu" >
<option value="c">Character</option>
<option value="r">Recommendation</option>
</select> </td>
<td> </td>
<td>
<input type="submit" name="Submit" id="button" value="Issue" onClick="return Validate();"/>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p></td>
</tr>
</table>
</form>
Below is the PHP coding..How can i edit the coding to fulfill my above requirement?
<?php
$admission_no=$_POST["admission_no"];
$report=$_POST["report"];
$date=date("Y-m-d");
$con=mysql_connect("localhost","root","");
mysql_select_db("student_management",$con);
if($report=="l"){
$query="insert into certificate values(null,'$admission_no','$report','$date')";
$result=mysql_query($query);
header("location:leavingCertificate.php?admission_no=".$admission_no."&report=".$report);
exit();
}
if($report=="c"){
$query="insert into certificate values(null,'$admission_no','$report','$date')";
$result=mysql_query($query);
header("location:characterCertificate.php?admission_no=".admission_no."&report=".$report);
exit();
}
if($report=="r"){
$query="insert into certificate values(null,'$admission_no','$report','$date')";
$result=mysql_query($query);
header("location:recommendLetter.php?admission_no=".$admission_no."&report=".$report);
exit();
}
?>