php - How to handle multiple submit buttons when the number of buttons is variable? -
what have tried accomplish here fetch data database , display form. how name submit buttons can identify them on actions page?
if(isset($_post["sch"])) { $_session['e']=$_post["phon"]; $result_set=mysql_query("select * bill_info phone='".$_session['e']."' , net_payable=0 order bill_no"); if($row=mysql_fetch_array($result_set)) { echo "<form name=\"shpen\" method=\"post\" action=\"vgbill2.php\"> <table border=\"0\">"; { echo "<tr><th>bills</th><th>action</th></tr>"; echo "<tr><td>".$row[0]."</td><td><input type=\"submit\" name=\"".$row[0]."\" value=\"generate\"></td></tr>"; } while($row=mysql_fetch_array($result_set)); //echo mysql_errno($con) . ": " . mysql_error($con) . "\r\n"; echo "</table></form>"; } else echo "\r\n"." no bills pending given phone number"." \r\n"; }
use button instead of input:
echo '<button type="submit" name="bt_submit" value="'.$row[0].'">generate</button>';
so former name in $_post['bt_submit']
.
Comments
Post a Comment