0

Hi Experts, below is my data file and I want to create form the basis of data returned by the following code.

getdata.php

<?php

include ("dbConnect.php");

$examID = $_POST['examID'];
 $sql= mysql_query("select * from examsub where examID='1');
         if(mysql_num_rows($sql)>0)
         {
             while($row=mysql_fetch_array($sql3))
            {
                               echo $row['examID'].$row['subject'].$row['thrymarks'].$row['pracmarks'].$row['subjectID'];
            } 

         }

?>

Below is the code from where when I press a button a form is create on the basic for rows returned by the above code.

$("#examID").change(function(){
     $.post("getdata.php", {examID: from.examID.value},
         function(str){
                        /*
                          // code here
                         */



            });
   });

Please help.

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by dany12
0

I don't see any html for your php rows.You should concatenet php with html using echo like this

 echo'<table id="grades_table">'.'<tr>'.'<td>' .$row['examID'].
 '</td>'.'</tr>'.'<tr>'.'<td>'.$row['subject'].'
 </td>'.'</tr>'.'<tr>'.'<td>'.$row['thrymarks'].'</td>'.'</tr>'.'<tr>'.'<td>'
 .$row['pracmarks'].'</td>'.'</tr>' .'<tr>'.'<td>'.$row['subjectID'].'</td>'.'</tr>'.'</table>';

Happy codding

Edited by dany12: mistake

0

Below is the code from where when I press a button a form is create on the basic for rows returned by the above code.

??

0

Yes it creates a table that puts every row of yours in a html table and if you want to create a button that will make you a form you will have to create a html form and in that form you have to create a button form there you will have to call the php to that file

something like this

<?php require_once(''aexternalphpfile); // use this if you have an external php form my point of view is a best practice?>
<form method="POST" action="yourphpfile">
<button name="create" value="create"></button>
</form>

// and in the external php file you will have an

   if(isset($_POST['create'])){

//run some code


}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.