array of submit buttons in different forms generated with php -
i dynamically create html forms loop in php , each submit button assigned name part of array. how can check submit button set , value? tried code doesn't work.
<?php if($count_eksp){for($i=0; $i<$count_eksp; $i++){ $fusha_eksp = mysql_fetch_row($query1); echo "<br>$fusha_eksp[2] $fusha_eksp[3]<form method='post' action='<?php echo $_server['php_self']; ?>'><input name='eksp_edit[]' type='submit' value='$fusha_eksp[0]' height='20' width='20' ><input id='eksp_fshi[]' type='image' src='fshi.png' height='20' width='20'></form>"; }} ?> <?php if(isset($_post['eksp_edit[]'])){ foreach($_post['eksp_edit'] $id){ $query = mysql_query("delete `fusha_ekspertizes` `id`='$id'", $db_server); } } ?>
you have error in if
condition, in key. remove []
that.
if (isset($_post['eksp_edit'])) { ... }
the second error in action attribute, can have <?
inside echo
. when form processed on same page, can leave attribute.
echo "[...]<form method='post'><input [...]";
Comments
Post a Comment