0
<html>
<head>
    <title></title>
</head>
<body>
<div style="background: rgb(238, 238, 238) none repeat scroll 0% 0%; border: 1px solid rgb(204, 204, 204); padding: 5px 10px; text-align: center;"><span style="color:#008000;"><span style="font-size: 20px;"><span style="font-family: lucida sans unicode,lucida grande,sans-serif;">BOOKS RENEWAL</span></span></span></div>

<p style="text-align: center;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p>

<table align="center" border="0" cellpadding="1" cellspacing="1" dir="ltr" height="79" style="height: 400px;" width="580">
    <tbody>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;">&nbsp; <span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">Roll Number</span></span></span></td>
            <td colspan="4"><input name="Rollno" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Name&nbsp;</span></span></span></td>
            <td colspan="4"><input name="Name" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Branch&nbsp;&nbsp;&nbsp; &nbsp; </span></span></span></td>
            <td><input name="Branch" type="text" /></td>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">Semester</span></span></span></td>
            <td colspan="2"><input name="Semester" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Call Number&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></td>
            <td><input name="Callno" type="text" /></td>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">Accession Number</span></span></span></td>
            <td colspan="2"><input name="Acc_no" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Author Name</span></span></span></td>
            <td colspan="4" rowspan="1"><input name="Auth_name" size="69" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Title Name&nbsp;&nbsp;&nbsp;</span></span></span></td>
            <td colspan="4" rowspan="1"><input name="title" size="69" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap; width: 50px;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Date of Issue</span></span></span></td>
            <td colspan="2" rowspan="1" style="white-space: nowrap; width: 300px;"><input name="Date_iss" size="10" type="text" /></td>
            <td rowspan="1" style="white-space: nowrap; width: 50px;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">Due&nbsp; Date</span></span></span></td>
            <td rowspan="1"><input name="Due_dt" size="10" type="text" /></td>
        </tr>
        <tr>
            <td style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Due Amount&nbsp;&nbsp;</span></span></span></td>
            <td colspan="2" rowspan="1"><input name="Due_amt" size="5" type="text" /></td>
            <td rowspan="1" style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">Amount Paid</span></span></span></td>
            <td rowspan="1"><input name="Amt_paid" size="5" type="text" /></td>
        </tr>
        <tr>
            <td colspan="5" style="white-space: nowrap;"><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp; Balance</span></span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span><input name="Balance" size="5" type="text" /></td>
        </tr>
    </tbody>
</table>



<p><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: tahoma,geneva,sans-serif;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></p>

<p style="text-align: center;"><input name="OK" type="button" value="OK" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="Exit" type="button" value="Exit" /></p>
</p>
</p>
</body>
</html>

Sir my question is first I will input Rollno and without submit I have to get the details pertaining to rollno from the database without refresh and then In the same page I will input accession number and again I have to get details pertaining to the accession number from the database. This can be done using vb, but If I want to do it in PHP how can I do it.

2
  • 6
    use ajax, there are tons of question on it on SO Commented Aug 2, 2015 at 14:29
  • Sir I tried but I could not able to get it. The form shown in html has so many fields however first I enter rollno then without refresh I have to get details from the mysql pertaining to roll no then I input accession number then details pertaining to that input has to be brought without refresh. finally I submit and all those details are to be updated in the database. If you could provide code it is solicited. Commented Aug 3, 2015 at 12:33

2 Answers 2

1

You can achieve your goal using AJAX. if you don't know about Ajax read here. A solution for the above would be adding the following:

<input name="Rollno" type="text" onblur="myFunction(this.value)" />

suppose you want to input values in

  <input name="Branch" type="text" />

then change it to

 <input name="Branch" type="text" id="change" value=""/>

now the javascript part

 <script>
 function myFunction(r){
 if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {
        // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("change").value= xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","getdetails.php?roll="+r,true);
    xmlhttp.send();      }
   </script>

now the php part

    if(isset($_GET['roll'])){
  // get the data for roll from the database and simply echo them here;}
       }

this is only a minimal solution to help you understand Ajax.

Sign up to request clarification or add additional context in comments.

Comments

0

You can also use jQuery.

<input type="text" id="get">
<div id="result"></div>

your jQuery code.

$("#get").blur(function (){
 var val = $('#get').val();
 $.post('data.php', {value: val}, function (data) {
   $('#result').html(data);
 }
}

in your php file

if(isset($_POST['value'])){
  $results = database query/results
  echo $results;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.