0

how can i make each of the table row clickable to go to new page? is it possible in javaScript?

 <?php 
   $query = mysql_query("SELECT * FROM instructor") or die(mysql_errno());                                
     while ($row=mysql_fetch_array($query)) {

   echo "
      <tr class='info'>
         <td><img src='".$row['profile_picture']."' width='30' height='30' style='border-radius:50%;'></td>
         <td>".$row['instructor_Id']."</td>
         <td>".$row['firstname']." ".$row['lastname']."</td>
         <td>".$row['age']."</td>
         <td>".$row['sex']."</td>
         <td>".$row['contact_no']."</td>
         <td>".$row['teaching_type']."</td>
      </tr>
                 "; 
       }
     ?>
  • I recommend using PHP just to handle data that gets `echo json_encode($assocArrayOrObj);`ed back to your JavaScript AJAX function, so you can a handle the rows and attach the Events at that time. – StackSlave Aug 13 '16 at 04:34
  • If that's just initial page load PHP, as opposed to AJAX acquired PHP, you just program the JavaScript as you usually would, because PHP executes first and the Elements will be defined `onload`. – StackSlave Aug 13 '16 at 04:40

0 Answers0