Orfius Posted January 16, 2010 Report Share Posted January 16, 2010 Kā lai mainīgajam $id = piešķir vajadzīgā ieraksta id? Paldies jau iepriekš! if ($_POST['del'] == "Dzest") { $id = result = "DELETE FROM tabula1 WHERE id='.$id.' " ; } do { echo '<table style="border : 1px solid black"> <tr> <td style="width : 100">'.$myrow['id'].'</td> <td style="width : 100">'.$myrow['vards'].'</td> <td style="width : 100">'.$myrow['uzvards'].'</td> <td style="width : 50"><form method="post"><input type="submit" name="del" style="width:50;border:1px solid;height:20" value="Dzest"></form></td> </tr> </table>'; } while ($myrow = mysql_fetch_array($result)); Quote Link to comment Share on other sites More sharing options...
euphoric Posted January 16, 2010 Report Share Posted January 16, 2010 formā ieliec hidden lauku ar value= $myrow['id'] name = id Attiecīgi : $id = $_POST['id']. Tagad iedomāies ka tavā ciklā izvada kaut vai 20 ierakstus, un pie katra ir taa poga 'delete'.. Tāpec taisi ar checkbox'iem un vienu pogu del :) Quote Link to comment Share on other sites More sharing options...
Kemito Posted January 16, 2010 Report Share Posted January 16, 2010 Ar $_GET var izvlikt id no linka, un attiecīgi pēc tā dzēst! Quote Link to comment Share on other sites More sharing options...
Orfius Posted January 16, 2010 Author Report Share Posted January 16, 2010 Paldies par palīdzību. Uztaisīju. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.