Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you did not mention about jQuery, but $.post is an available method on jQuery. if you are using jQuery and include it to your page it's ok. than you can do that like this,</p> <pre><code>$('form[name=DeleteMarker]').submit(function() { var dataString = $(this).serialize(); $.post("index.php", dataString); return false; }); </code></pre> <hr> <p><strong>EDIT:</strong></p> <p>Actually your <code>deleteRecord()</code> function has some other incorrect usage.</p> <p><code>confirm()</code> returns a boolean(true or false), so you have to use this returned value to continue your code.</p> <p><code>if(confirm) {}</code> is not right way to do it, </p> <p>you must use it like,</p> <pre><code>var c = confirm("do you confirm?"); if(c) { //yes it's confirmed. } </code></pre> <p>or more useful,</p> <pre><code>if(confirm("do you confirm?")) { //yes it's confirmed. } </code></pre> <hr> <p>you said '<strong>the url is still just "index.php"</strong>', how did you look that, I don't know but it's normal, because the method is not GET, so url will not include posted data as querystring. If it doesn't work, there might be some other problem. </p> <hr> <hr> <p><strong>EDIT-2:</strong> Actually there is no differences between them, ok here is a full example, you can look your browser javascript dev-tool to see what's happening on background.</p> <pre><code>&lt;?php if(isset($_GET['DEmployee'])) { $sql="DELETE FROM Splices WHERE (Employee='$_POST[DEmployee]' AND Job='$_POST[DJob]' AND Customer='$_POST[DCustomer]' AND Latitude=$_POST[DLatitude] AND Longitude=$_POST[DLongitude])"; if (!mysql_query($sql,$Splices)) { echo "Error: ". mysql_error(); } else { echo "employee deleted"; } } else { //you can add something else here //&lt;div&gt;blablabla&lt;/div&gt; //and the form for delete ?&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("form[name=DeleteMarker]").submit(function() { if(confirm("This will be deleted, are you sure?")) { var dataString = $(this).serialize(); $.get("index.php", dataString , function(data){ alert(data); }); } return false; }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="DeleteMarker" method="GET"&gt; &lt;fieldset class="Splice"&gt; &lt;legend&gt;Delete Marker&lt;/legend&gt; &lt;label for="DEmployee" &gt;Employee: &lt;/label&gt; &lt;select name="DEmployee"&gt; &lt;option value="name1"&gt;name1&lt;/option&gt; &lt;/select&gt; &lt;label for="DJob"&gt;Job Name: &lt;/label&gt; &lt;select name="DJob"&gt; &lt;option value="job1"&gt;job1&lt;/option&gt; &lt;/select&gt; &lt;label for="DCustomer"&gt;Customer Name: &lt;/label&gt; &lt;select name="DCustomer"&gt; &lt;option value="cusname1"&gt;customer name1&lt;/option&gt; &lt;/select&gt; &lt;br&gt; &lt;label&gt;Latitude: &lt;/label&gt;&lt;input name="DLatitude" min="-180" max="180" step="0.00001" required /&gt; &lt;label&gt;Longitude: &lt;/label&gt;&lt;input name="DLongitude" min="-180" max="180" step="0.00001" required /&gt; &lt;br&gt; &lt;input type="submit" value="Delete" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php } ?&gt; </code></pre>
 

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