Note that there are some explanatory texts on larger screens.

plurals
  1. POAttendee List with confirmation delete button
    primarykey
    data
    text
    <p>I have an attendee list with records of whom have filled out the event form. Each table row has a delete button attached so that the administrator can delete a record from the database. I have tried to attach a confirmation dialog (yes/no) to the form when a delete button is clicked.</p> <p>Before i attached the javascript it was deleteing a record fine, but now although the dialog box appears and works it is not deleting the record. Here is my code:</p> <pre><code>&lt;form id="attending" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt; &lt;table class="attendees"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="name"&gt;Name&lt;/th&gt; &lt;th class="company"&gt;Company&lt;/th&gt; &lt;th class="email"&gt;Email&lt;/th&gt; &lt;th class="contact"&gt;Contact&lt;/th&gt; &lt;th class="day"&gt;Day&lt;/th&gt; &lt;th class="time"&gt;Time&lt;/th&gt; &lt;th class="delete"&gt;&amp;nbsp;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;?php while ($row = mysql_fetch_assoc($result)) { ?&gt; &lt;tr&gt; &lt;input type="hidden" name="id" value="&lt;?php echo $row['id']; ?&gt;"&gt; &lt;td class="name"&gt;&lt;?php echo $row['name']; ?&gt;&lt;/td&gt; &lt;td class="company"&gt;&lt;?php echo $row['company']; ?&gt;&lt;/td&gt; &lt;td class="email"&gt;&lt;?php echo $row['email']; ?&gt;&lt;/td&gt; &lt;td class="contact"&gt;&lt;?php echo $row['contact']; ?&gt;&lt;/td&gt; &lt;td class="day"&gt;&lt;?php echo $row['day']; ?&gt;&lt;/td&gt; &lt;td class="time"&gt;&lt;?php echo $row['event-time']; ?&gt;&lt;/td&gt; &lt;td class="delete"&gt;&lt;input type="submit" name="delete" class="delete-button" value="Delete"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php if(isset($_POST['delete'])) { $id = $_POST['id']; mysql_query("DELETE FROM `registered_blue` WHERE `id` = '$id' "); } ?&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>Here is my jquery that follows:</p> <pre><code>var confirmDelete = $('&lt;div&gt;&lt;/div&gt;') .html('Record will be deleted! This operation can\'t be undone. &lt;br /&gt;Are you sure?') .dialog({ autoOpen: false, title: 'Attendee will be deleted! Please Confirm.', buttons: {"Yes": function() { $(this).dialog("close"); $('#attending').submit(); }, "No": function() { $(this).dialog("close"); } } }); $('.delete-button').on('click', function(e){ e.preventDefault(); $(confirmDelete).dialog('open'); }); </code></pre> <p>Can someone tell me where I'm going wrong? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload