[jQuery] Form Plugin > Opening up PHP
Well my php and forms run fine, but when I click submit it jumps into the PHP
page when it should stay put and submit data without opening PHP in the
window.
Code:
Jquery:
$('#myform').ajaxForm(function() {
return false;
alert("Thank you for your comment!");
});
Page
echo "<form id='myform' action='edit.php' method='post'>";
echo "Article: <input type='text' size='3' value='$artid' name='artid' />";
echo "<textarea rows='28' cols='130' name='body'>";
echo $row['article_body'];
echo "</textarea><input type='submit' value='Save Changes' /></form>";
echo "<div id='formconf' style='display: none;'>Changes made</div>";
Script:
<?php
$artid = $_POST['artid'];
$article_body= $_POST["body"];
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
mysql_query("UPDATE `articles` SET article_body = '$article_body' WHERE
article_id = '$artid'") or die(mysql_error());
?>
I'm not sure why it's not working, It does submit, the database changes, but
it opens up the script instead of staying within the page.... all help is
definitely appreciated.
Thanks!
--
View this message in context: http://www.nabble.com/Form-Plugin-%3E-Opening-up-PHP-tf4251270s15494.html#a12099630
Sent from the JQuery mailing list archive at Nabble.com.