romio Posted June 3, 2006 Share Posted June 3, 2006 In the past i used to delete though the use of a form and a submit button,[code]$find = "SELECT * FROM countries order by ID"; $row= mysql_query($find);$num_rows = mysql_num_rows($row);if(isset($_POST["delete"])){ for($i=0;$i<$num_rows;$i++) { $cb = $_POST['cb']; $delete_records = $cb[$i]; $sql = "DELETE FROM countries WHERE ID=$delete_records"; $result = mysql_query($sql); }}mysql_close();[/code][code]<td width='25' class='lign_3'><input type=checkbox name=cb[] value=$id></td>[/code]But now i need to use a link instead of a submit button, How can I do that? Quote Link to comment https://forums.phpfreaks.com/topic/11078-delete-link-not-a-submit-button/ Share on other sites More sharing options...
Zanjo Posted June 3, 2006 Share Posted June 3, 2006 What exactly does the check box do? If it confirms it then just make one link goto delete.php?confirm=yes and go isset($_GET['confirm']). Quote Link to comment https://forums.phpfreaks.com/topic/11078-delete-link-not-a-submit-button/#findComment-41419 Share on other sites More sharing options...
seanlim Posted June 3, 2006 Share Posted June 3, 2006 you can try using javascript formname.submit()HTH Quote Link to comment https://forums.phpfreaks.com/topic/11078-delete-link-not-a-submit-button/#findComment-41421 Share on other sites More sharing options...
romio Posted June 3, 2006 Author Share Posted June 3, 2006 [!--quoteo(post=379588:date=Jun 3 2006, 05:12 AM:name=Zanjo)--][div class=\'quotetop\']QUOTE(Zanjo @ Jun 3 2006, 05:12 AM) [snapback]379588[/snapback][/div][div class=\'quotemain\'][!--quotec--]What exactly does the check box do? If it confirms it then just make one link goto delete.php?confirm=yes and go isset($_GET['confirm']).[/quote]Basically i am listing some rows from my database, next to each record the checkbox appear, if that check box is selected and the user clicks on the delete link then all checkboxes must be deleted....[code] while($row = mysql_fetch_array($query_posts)) { $name = $row['name']; $email = $row['email']; $message = $row['message']; $id = $row['user_id']; $length = 27; if (strlen($message) <= $length) { $message = $message; } else { $message = substr($message, 0, $length) . ".."; } echo "<tr> <td width='25' class='lign_3'><input type=checkbox name=cb[] value=$id></td> <td width='120' class='lign_3'> $current_date</td> <td width='150' class='lign_4'> <a href=\"javascript:popUp('popup.php?&id=$id')\" class='links'>$message</a></td> <td width='80' class='lign_3'>$name</a></td> <td width='100' class='lign_3'> 201.201.201.201</td> <td width='45' class='lign_3'>P</td> <td width='45' class='lign_3'> <a href='admin.php?select=7&id=$id' class='links'><img src='template/images/edit.gif' border='0' title='Edit Post'></a></td> </tr>"; }[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11078-delete-link-not-a-submit-button/#findComment-41463 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.