Hi,
I have the following PHP form that I am trying to execute with the
Ajax.Updater. Can someone check my syntax, because the page is still
completely refreshing?
<< 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","<usernnamehidden>","<passwordhidden>");
if (!$con)
{
die(''Could not connect: '' . mysql_error());
}
mysql_select_db("<dbnamehidden>", $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
-~----------~----~----~----~------~----~------~--~---
(sorry if this is a duplicate)
Hi,
I''m trying to use Ajax.Updater to call a PHP page that inserts some
data and returns a string into a div. The only problem is that the
page is still completely refreshing. Here is my code. Any help is
appreciated.
<< 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
-~----------~----~----~----~------~----~------~--~---