Note that there are some explanatory texts on larger screens.

plurals
  1. POJSON usage while autofill the form when user changes the category
    primarykey
    data
    text
    <p>i'm trying to fill the form with database information when user changes the category(select tag changes). here is my code.</p> <pre><code>&lt;form onsubmit='return false'&gt; select&lt;select id="select"&gt; &lt;option value='5'&gt;5&lt;/option&gt; &lt;option value='6'&gt;6&lt;/option&gt; &lt;option value='7'&gt;7&lt;/option&gt; &lt;option value='8'&gt;8&lt;/option&gt; &lt;option value='9'&gt;9&lt;/option&gt; &lt;option value='10'&gt;10&lt;/option&gt; &lt;/select&gt; fname&lt;input type="text" id='fname' name="fname" /&gt;&lt;br /&gt; lname&lt;input type="text" id='lname' name="lname" /&gt;&lt;br /&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#select").change(function(){ selectid = $(this).val(); // using post method to get firstname $.post("retreive.php", {selectid:selectid}, function(result){ $("#fname").val(); //again using post method here get lastname $.post("one.php", {selectid:selectid}, function(result){ $("#lname").val(); }); }); }); }); </code></pre> <p></p> <p>retreive.php</p> <pre><code>&lt;?php //for firstname if( isset($_POST['selectid']) ){ //using this selectid i'm getting firstname echo $firstname; exit(); } //again for last name if( isset($_POST['selectid']) ){ //using this selectid i'm getting firstname echo $lastname; exit(); } ?&gt; </code></pre> <p>Finally this procedure auto filling the form fields i.e; firstname and lastname. I know this is foolish and time taken procedure. I've heard that this work done easily and no need to make our php bare all that burden with using the concept of JSON. I have tried to understand but couldn't. I hope you guys can understand the problem i'm facing, hoping for a solution. Thanks in advance! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload