-2

I want fill the text-box value from the database on the basis of on change event of drop-down list in php

Actually my work flow is when i select a value by drop-down list, on the base of that selected value (on-change event) the filtered record should be in the text box using php

<head>
<script>

function SelectedTemplate()
{
    what type of code i have to there?![for detail please see image i have posted][1]


</script>
</head>
<body>
    <?php
    $result=mysql_query("SELECT * FROM tbltemplate where UserName = '$name' " );
    if($result != '')
    {   
        while($test = mysql_fetch_array($result))
        {
    echo'<option value="' .$test['TempID']. '">' .$test['TempTitle']. '</option>';
    }
    }
?>
</body>
Ashish Ratan
  • 2,838
  • 1
  • 24
  • 50
Majid Hafeez
  • 1
  • 1
  • 3

2 Answers2

0

You can simply get the data from the database and put into variables and then add the variables to the textbox value. Please post your code to let me solve your problem easily

AFB
  • 550
  • 2
  • 8
  • 25
0

You should use ajax for this. ( value comes after you make a select from dropdown box ) Here is it all explained:

Using AJAX to return query results based on drop down box

BR's

Community
  • 1
  • 1
user2831723
  • 832
  • 12
  • 25