Hi,
I''m trying to post to a PHP insert script and return the confirmation
text in a div with Ajax.Updater, but I''m having little luck. Does
anyone have any thoughts on my implementation? The page currently
refreshes completely.
Thanks.
< rsvp.php >
<html>
<head>
<script src="prototype.js"
type="text/javascript"></script>
<script src="scriptaculous.js"
type="text/javascript"></script>
</head>
<body>
<!-- -->
<form action="insert.php" method="post"
onsubmit="new
Ajax.Updater(''thanks'', ''insert.php'',
{asynchronous:true};">
Firstname: <input type="text" name="firstname" />
Lastname: <input type="text" name="lastname" />
RSVP: <input type="text" name="rsvp" />
Number <input type="text" name="number" />
<input type="submit" />
</form>
<div id="thanks"></div>
</body>
</html>
< insert.php >
<?php
$con =
mysql_connect("localhost","<hidden>","<hidden>");
if (!$con)
{
die(''Could not connect: '' . mysql_error());
}
mysql_select_db("<hidden>", $con);
$sql="INSERT INTO RSVP (firstname, lastname, rsvp, number)
VALUES
(''$_POST[firstname]'',''$_POST[lastname]'',''$_POST[age]'',''$_POST[number]'')";
if (!mysql_query($sql,$con))
{
die(''Error: '' . mysql_error());
}
echo "Thank You $firstname For Your RSVP!";
mysql_close($con)
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---