I am using the following JS to verify whether they wish to delete or not. For some reason when i click the delete button and click ok it does not delete the entry, but if i click it a second time it does delete it. Anyone have any suggestions to how i can solve this issue?
This is the formCode:function delete_record (form) { var coupon1 = form.coupon1.value; var where_to = confirm("Do you really want to delete " + coupon1 + "?"); if (where_to == true) { var delete_var = form.delete_id.value; var delete_url = "delete.php?id=" + delete_var; window.location = delete_url; } }
This is the delete.phpCode:<form class='delete_buttons' method='POST'> <input type='hidden' value='" . $recc['coupon'] . "' name='coupon1' /> <input type='hidden' value='" . $recc['id'] . "' name='delete_id' /> <input type='image' src='images/delete.gif' title='". $index_delete . $recc['coupon'] ."' onClick='delete_record(this.form)' /> </form>
Code:$delete_id = $_GET['id']; $query = "DELETE FROM coupons where id=" . $delete_id . " LIMIT 1"; mysql_query($query); echo '<meta http-equiv="refresh" content="0;url=index.php" />';


LinkBack URL
About LinkBacks
Reply With Quote

