title: PHP- Auto fill the data when ID is provided
body: <p>I have two forms here. <strong>Registration</strong> and <strong>Payment</strong>. In the <strong>registration</strong> form i have fields hosteladmissionnumber,student name,sex,semester,branch.etc.. and in the Payment form,I have hosteladmissionnumber,Demand Draft number,DD date,Bank Name etc... </p>
  
  <p>The question here is:
  When i enter the hosteladmissionnumber in <strong>payment</strong> form, it must display the Text boxes of studentname,semester,Branch(only 3 fields) from the <strong>registration</strong> table in my database.How can i do this? Any suggestions? Do i really need to do this with three text boxes or is there any alternate way? Im using PHP as frontend and Mysql as Backend.</p>
  
  <p>For payment part, the code is:(PHP)</p>
  
  <pre><code>&lt;?php
  session_start();
     $hostad=$_POST['hosteladmissionno'];
     //$sem=$_POST['student_name'];
     //$sem=$_POST['semester'];
     $ddno=$_POST['ddno'];
     $dd=$_POST['ddamount'];
     $bname=$_POST['bankname'];
     $dddate=$_POST['dddate'];
     $mess=$_POST['messamount'];
     $room=$_POST['roomamount'];
     $receipt=$_POST['receiptnumber'];
  
  $con=mysql_connect('localhost','root','');
  
  if(!$con)
  {
  die('Unable to connect'.mysql_error());
  }
  mysql_select_db('hostel',$con);
  
  
  if(isset($sem)&amp;&amp;isset($dd)&amp;&amp;isset($bname)&amp;&amp;isset($dddate)&amp;&amp;isset($mess)&amp;&amp; isset($room)&amp;&amp;isset($receipt))
  {
  $r1="INSERT INTO payment(hosteladmissionno,semester,ddno,ddamount,bankname,dddate,messamount,roomamount,receiptnumber)
  VALUES ($hostad','$sem','$ddno','$dd','$bname','$dddate','$mess','$room','$receipt')";
  mysql_query($r1);
  $r2="UPDATE registration SET status_flag=1 WHERE hosteladmissionno='$hostad'";
  mysql_query($r2);
  }
  if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
   // echo 'hello("',$rollnumber,'");', "\n";
   echo "&lt;script language='javascript'&gt;alert('Successfuly Paid');&lt;/script&gt;"; }
  mysql_close($con);
  ?&gt;
  </code></pre>