How to trigger PHP/jquery when a button is clicked
<p>PHP noob here...so please excuse me if you find this to be a lame question.</p>

<p>I have the following form:</p>

<p>HTML </p>

<pre><code>&lt;form id="myForm" action="" method="post"&gt;
&lt;div id="edit-box"&gt;
&lt;INPUT type="submit" name="save-text" id="save-text" value="Save"&gt;
&lt;textarea id="editor" name="editor"&gt;
&lt;?php echo $content; ?&gt;
&lt;/textarea&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>PHP</p>

<pre><code>if ($_POST["save-text"]){

// get form data, making sure it is valid
$submit_date = date('Y-m-d H:i:s');
$content = mysql_real_escape_string(htmlspecialchars($_POST['editor']));
$url = "http://example.com/" . $key;


// build query
mysql_query("INSERT INTO `source`(`id`, `key`, `submit_date`, `ip`, `content`) 
VALUES (null, '$key','$submit_date','$ip','$content')")
or die(mysql_error());

}
</code></pre>

<p>How can I make sure that the PHP script is run only when the submit button is clicked and no other time?</p>
