Hi!
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:
[code=php]<table id = "MAINFORM">
<form name = "complaint_sett ings" 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">Co mplaint: <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("SE LECT * 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>Compla int</th>";
while ($comp_rec= mysql_fetch_arr ay($complaintTa ble))
{echo "<tr><td>"; echo $comp_rec['complaint']; echo "</td>";}
echo "</tr></table>";[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
THANKS IN ADVANCE.
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:
[code=php]<table id = "MAINFORM">
<form name = "complaint_sett ings" 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">Co mplaint: <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("SE LECT * 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>Compla int</th>";
while ($comp_rec= mysql_fetch_arr ay($complaintTa ble))
{echo "<tr><td>"; echo $comp_rec['complaint']; echo "</td>";}
echo "</tr></table>";[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
THANKS IN ADVANCE.
Comment