Auto filling the Text boxes
Posted: Wed Apr 06, 2011 12:48 am
Hello all,
I have three text fields ( hosteladmissionnumber,branch & Semester) and three text boxes in a form. When i provide the hostel admission number , the corresponding branch semester must be acquired from the registrationtable in DB and fill it in text boxes. How can i do it? any help would be appreciated. Thanks. I have pasted the code below.
I have three text fields ( hosteladmissionnumber,branch & Semester) and three text boxes in a form. When i provide the hostel admission number , the corresponding branch semester must be acquired from the registrationtable in DB and fill it in text boxes. How can i do it? any help would be appreciated. Thanks. I have pasted the code below.
Code: Select all
<?php
session_start();
$hostad=$_POST['hosteladmissionno'];
$sem=$_POST['student_name'];
$sem=$_POST['semester'];
$con=mysql_connect('localhost','root','');
if(!$con)
{
die('Unable to connect'.mysql_error());
}
mysql_select_db('hostel',$con);
//i have to insert the hosteladmission in payment too..but no need to insert semester and branch
$r1="INSERT INTO payment(hosteladmissionno) values ('$hostad')";
mysql_close($con);
?>
/HTML PART
<form action='payment.php' method='POST' name='form1'>
<center>
<table>
<tr><td><b>Admission No:</b></td><td><input type='text' name='hosteladmissionno'></td></tr>
<tr><td><b>Student Name:</b></td><td><input type='text' name='student_name'></td></tr>
<tr><td><b>Semester:</b></td><td><input type='text' name='semester'></td></tr>