Have been hitting my head on the wall for two weeks now. am a php newbie. have a form that on submitting to a MySQL DB instantly generates a HTML table on the same page. what i need now is way to be able to select rows from this table. specific selected row info sent back to text-box in my multi-button form for further processing depending on which button i click. have been trying to study javascript onclcik event handlers to see if this could be the solution. my scripts for multi-button form and generated table below:
1. Form:
Expand|Select|Wrap|Line Numbers
- <table id = "MAINFORM">
- <form name = "complaint_settings" method = "POST" action = "php_complaint_mysql.php">
- <td>
- <!--<div align = "left"></div> -->
- <table border = "3" bordercolor = "gold" bgcolor = "00008B">
- <tr><td>
- <p style = "color:gold">Complaint: <br>
- <input type = "text" size = "50" maxlength = "50" name = "complaint"></td></tr><br>
- <tr><td>
- <input type = "submit" name = "submit_c" value = "submit"> <br>
- <input type = "submit" name = "submit_c" value = "update"> <br>
- <input type = "submit" name = "submit_c" value = "delete" onClick = "return confirm('Are you sure you want to delete record?')">
- </td></tr>
- 2. Generated Table based on submission from above form:
- //initializing extraction of complaint parameters from mysql
- $complaintTable = mysql_query("SELECT * FROM complaint") or die (mysql_error());
- //store complaint records into array $complaint_row &&
- //create table of mysql complaint array
- echo "<table>";
- echo "<td><div>";"</div></td>";
- echo "<table id = \"table_c\" border = \"4\" bordercolor = 00008B>";
- echo "<tr><th>Complaint</th>";
- while ($comp_rec= mysql_fetch_array($complaintTable))
- {echo "<tr><td>"; echo $comp_rec['complaint']; echo "</td>";}
- echo "</tr></table>";
THANKS IN ADVANCE.