Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 11:42 am EST
Geeklog Forums
RSVP Functionality
Hello,
I have a wedding coming up and wanted to handle our reservations (aka RSVP) online. My question is, does anyone know a good way to create a form that we can use to collect RSVP info? I'm also hoping to have a report that I can use from the admin section to view the RSVP data.
I've tried PHP Form Generator, but I didn't like it's flexability. I'm kinda of hoping for a one-off source code sample, but would take assistance in any form.
Any help that you can provide would be greatly appreciated, thanks!
Jeff.
I have a wedding coming up and wanted to handle our reservations (aka RSVP) online. My question is, does anyone know a good way to create a form that we can use to collect RSVP info? I'm also hoping to have a report that I can use from the admin section to view the RSVP data.
I've tried PHP Form Generator, but I didn't like it's flexability. I'm kinda of hoping for a one-off source code sample, but would take assistance in any form.
Any help that you can provide would be greatly appreciated, thanks!
Jeff.
14
15
Quote
Oh yeah, I suppose I left something off my previous post. By my description I'm obviously thinking that the RSVP form and report would post/get data from a geeklog database table.
However, if there was a way to also email the form results to a specific email address that would be great too!
I hope someone out there has some thoughts on this...
However, if there was a way to also email the form results to a specific email address that would be great too!
I hope someone out there has some thoughts on this...
10
11
Quote
Status: offline
jbpaul17
Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
Yeah, Blaine's glEvents premium plugin is pretty amazing. However, it appears to necessitate that people using it must be logged in users of the GL site; this isn't something that I imagine all our wedding guests will actually be.
I've also took a look at PHP Surveyor last night, but the admin facility to assemble a survey/rsvp form was a bit difficult to comprehend.
So, unless someone's got something available or a nice set of code that's re-useable I suppose I'll just have to buckle down and figure out some PHP code.
Any thoughts?
I've also took a look at PHP Surveyor last night, but the admin facility to assemble a survey/rsvp form was a bit difficult to comprehend.
So, unless someone's got something available or a nice set of code that's re-useable I suppose I'll just have to buckle down and figure out some PHP code.
Any thoughts?
14
16
Quote
Status: offline
jbpaul17
Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
Alright, I've put cobbled together some code that I've found online, but I'm still having some problems. Here's what I've got:
<html>
<head>
<title>RSVP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
//initilize PHP
if($_POST['submit']) //If submit is hit
{
//then connect as user
//change user and password to your mySQL name and password
//global $_TABLES;
mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to edit
mysql_select_db("DB_EDITED_OUT");
//convert all the posts to variables:
$rsvp_id = $_POST['rsvp_id'];
$accept = $_POST['accept'];
$title = $_POST['title'];
$name = $_POST['name'];
$entree = $_POST['entree'];
$title2 = $_POST['title2'];
$name2 = $_POST['name2'];
$entree2 = $_POST['entree2'];
$title3 = $_POST['title3'];
$name3 = $_POST['name3'];
$entree3 = $_POST['entree3'];
$title4 = $_POST['title4'];
$name4 = $_POST['name4'];
$entree4 = $_POST['entree4'];
$title5 = $_POST['title5'];
$name5 = $_POST['name5'];
$entree5 = $_POST['entree5'];
$shuttle = $_POST['shuttle'];
$flight = $_POST['flight'];
$transport = $_POST['transport'];
$email = $_POST['email'];
$comments = $_POST['comments'];
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
// if ($name != NULL)
$result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name2 != NULL)
// $result= MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title2', '$name2', '$entree2', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name3 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title3', '$name3', '$entree3', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name4 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title4', '$name4', '$entree4', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name5 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title5', '$name5', '$entree5', '$shuttle', '$flight', '$transport', '$email', '$comments')");
//confirm
echo "Query Finished";
}
else
{
// close php so we can put in our code
-->
<form method="post" action="http://www.jeffandcrystal.com/rsvp/rsvp4.php">
<table style="border-collapse: separate;" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td width="253" colspan="2">
<input type="radio" value="Accept" name="accept">Accept with Pleasure</td>
<td width="731" colspan="2">
<input type="radio" value="Decline" name="accept">Decline with Regret</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3"> Names Of Those Attending In Your Party</td>
<td width="634">Desired Entree</td></tr>
<tr>
<td width="350" colspan="3">1. <select size="1" name="title">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name"></td>
<td width="634"><select size="1" name="entree">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">2. <select size="1" name="title2">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name2"></td>
<td width="634"><select size="1" name="entree2">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">3. <select size="1" name="title3">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name3"></td>
<td width="634"><select size="1" name="entree3">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">4. <select size="1" name="title4">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name4"></td>
<td width="634"><select size="1" name="entree4">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">5. <select size="1" name="title5">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name5"></td>
<td width="634"><select size="1" name="entree5">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require shuttle service from the airport to The Clarion Hotel?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="shuttle">Yes</td>
<td width="164">
<input type="radio" value="No" name="shuttle">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Flight Arrival Time:
<input type="text" size="15" value="" name="flight"></td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require transportation from The Clarion Hotel to the Ceremony and back?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="transport">Yes</td>
<td width="164">
<input type="radio" value="No" name="transport">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Email Address (optional):
<input type="text" size="30" value="" name="email"></td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Comments/Questions (optional):</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4"><textarea name="comments" rows="5" cols="60"> </textarea></td></tr>
<tr>
<td width="89">
<p> </p>
</td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr><tr>
<td width="89">
<input type="submit" value="submit" name="submit"></td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr></tbody></table></form><!--} //close the else statement
-->
</body>
</html>
Any ideas why this code isn't posting to the database?
Text Formatted Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<title>RSVP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
//initilize PHP
if($_POST['submit']) //If submit is hit
{
//then connect as user
//change user and password to your mySQL name and password
//global $_TABLES;
mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to edit
mysql_select_db("DB_EDITED_OUT");
//convert all the posts to variables:
$rsvp_id = $_POST['rsvp_id'];
$accept = $_POST['accept'];
$title = $_POST['title'];
$name = $_POST['name'];
$entree = $_POST['entree'];
$title2 = $_POST['title2'];
$name2 = $_POST['name2'];
$entree2 = $_POST['entree2'];
$title3 = $_POST['title3'];
$name3 = $_POST['name3'];
$entree3 = $_POST['entree3'];
$title4 = $_POST['title4'];
$name4 = $_POST['name4'];
$entree4 = $_POST['entree4'];
$title5 = $_POST['title5'];
$name5 = $_POST['name5'];
$entree5 = $_POST['entree5'];
$shuttle = $_POST['shuttle'];
$flight = $_POST['flight'];
$transport = $_POST['transport'];
$email = $_POST['email'];
$comments = $_POST['comments'];
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
// if ($name != NULL)
$result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name2 != NULL)
// $result= MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title2', '$name2', '$entree2', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name3 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title3', '$name3', '$entree3', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name4 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title4', '$name4', '$entree4', '$shuttle', '$flight', '$transport', '$email', '$comments')");
// if ($name5 != NULL)
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title5', '$name5', '$entree5', '$shuttle', '$flight', '$transport', '$email', '$comments')");
//confirm
echo "Query Finished";
}
else
{
// close php so we can put in our code
-->
<form method="post" action="http://www.jeffandcrystal.com/rsvp/rsvp4.php">
<table style="border-collapse: separate;" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td width="253" colspan="2">
<input type="radio" value="Accept" name="accept">Accept with Pleasure</td>
<td width="731" colspan="2">
<input type="radio" value="Decline" name="accept">Decline with Regret</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3"> Names Of Those Attending In Your Party</td>
<td width="634">Desired Entree</td></tr>
<tr>
<td width="350" colspan="3">1. <select size="1" name="title">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name"></td>
<td width="634"><select size="1" name="entree">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">2. <select size="1" name="title2">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name2"></td>
<td width="634"><select size="1" name="entree2">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">3. <select size="1" name="title3">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name3"></td>
<td width="634"><select size="1" name="entree3">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">4. <select size="1" name="title4">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name4"></td>
<td width="634"><select size="1" name="entree4">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">5. <select size="1" name="title5">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name5"></td>
<td width="634"><select size="1" name="entree5">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require shuttle service from the airport to The Clarion Hotel?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="shuttle">Yes</td>
<td width="164">
<input type="radio" value="No" name="shuttle">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Flight Arrival Time:
<input type="text" size="15" value="" name="flight"></td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require transportation from The Clarion Hotel to the Ceremony and back?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="transport">Yes</td>
<td width="164">
<input type="radio" value="No" name="transport">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Email Address (optional):
<input type="text" size="30" value="" name="email"></td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Comments/Questions (optional):</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4"><textarea name="comments" rows="5" cols="60"> </textarea></td></tr>
<tr>
<td width="89">
<p> </p>
</td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr><tr>
<td width="89">
<input type="submit" value="submit" name="submit"></td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr></tbody></table></form><!--} //close the else statement
-->
</body>
</html>
Any ideas why this code isn't posting to the database?
11
17
Quote
Status: offline
jbpaul17
Forum User
Chatty
Registered: 05/14/04
Posts: 49
Location:New York City
Ok, now I've managed to submit data from my RSVP form into the database. I created a static page with an iframe within it that links to the following page of code:
<html>
<head>
<title>RSVP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<SCRIPT LANGUAGE="Javascript">
function validate() {
if (!(rsvpform.accept[0].checked || rsvpform.accept[1].checked)) {
alert('Please select either Accept or Decline, thanks!');
event.returnValue=false;
}
else {
rNv=rsvpform.name.value;
if (rNv=='') {
alert('Please enter your name so we can properly track responses, thanks!');
event.returnValue=false;
}
}
}
</SCRIPT>
<?
//initilize PHP
//$_TABLES['gl_rsvp'] = $_DB_table_prefix . 'gl_rsvp';
if($_POST['submit']) //If submit is hit
{
//then connect as user
//change user and password to your mySQL name and password
//global $_TABLES;
//mysql_connect("localhost","user","password");
//mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to edit
mysql_select_db("DB_EDITED_OUT");
//convert all the posts to variables:
$rsvp_id = $_POST['rsvp_id'];
$accept = $_POST['accept'];
$title = $_POST['title'];
$name = $_POST['name'];
$entree = $_POST['entree'];
$title2 = $_POST['title2'];
$name2 = $_POST['name2'];
$entree2 = $_POST['entree2'];
$shuttle = $_POST['shuttle'];
$flight = $_POST['flight'];
$transport = $_POST['transport'];
$email = $_POST['email'];
$comments = $_POST['comments'];
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
$result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
if ($name2 != NULL) {
$result2=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title2', '$name2', '$entree2', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name3 != NULL) {
$result3=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title3', '$name3', '$entree3', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name4 != NULL) {
$result4=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title4', '$name4', '$entree4', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name5 != NULL) {
$result5=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title5', '$name5', '$entree5', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
//confirm
echo $name;
echo ", thank you for responding to our RSVP.";
if ($accept == 'Accept')
echo " We cannot wait to see you there!";
else
echo " Sorry you couldn't join us.";
}
else{
// close php so we can put in our code
?>
<form name="rsvpform" method="post" onsubmit="validate();" action="http://www.jeffandcrystal.com/rsvp/rsvp4.php">
<table style="border-collapse: separate;" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td width="253" colspan="2">
<input type="radio" value="Accept" name="accept">Accept with Pleasure</td>
<td width="731" colspan="2">
<input type="radio" value="Decline" name="accept">Decline with Regret</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3"> Names Of Those Attending In Your Party</td>
<td width="634">Desired Entree</td></tr>
<tr>
<td width="350" colspan="3">1. <select size="1" name="title">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name"></td>
<td width="634"><select size="1" name="entree">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">2. <select size="1" name="title2">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name2"></td>
<td width="634"><select size="1" name="entree2">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">3. <select size="1" name="title3">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name3"></td>
<td width="634"><select size="1" name="entree3">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">4. <select size="1" name="title4">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name4"></td>
<td width="634"><select size="1" name="entree4">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">5. <select size="1" name="title5">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name5"></td>
<td width="634"><select size="1" name="entree5">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require shuttle service from the airport to The Clarion Hotel?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="shuttle">Yes</td>
<td width="164">
<input type="radio" value="No" name="shuttle">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Flight Arrival Time:
<input type="text" size="15" value="" name="flight"></td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require transportation from The Clarion Hotel to the Ceremony and back?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="transport">Yes</td>
<td width="164">
<input type="radio" value="No" name="transport">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Email Address (optional):
<input type="text" size="30" value="" name="email"></td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Comments/Questions (optional):</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4"><textarea name="comments" rows="5" cols="60"> </textarea></td></tr>
<tr>
<td width="89">
<p> </p>
</td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr><tr>
<td width="89">
<input type="submit" value="submit" name="submit"></td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr></tbody></table></form>
<?
} //close the else statement
?>
</body>
</html>
That code successfully loads all the data into my database correctly. Now, I'm trying to design a simple report that'll pull out the data and display it in a simple table format. Here's the code that I have so far:
<TR>
<TD>Accept</TD>
<TD>Title</TD>
<TD>Name</TD>
<TD>Entree</TD>
<TD>Shuttle</TD>
<TD>Flight</TD>
<TD>Transport</TD>
<TD>Email</TD>
<TD>Comments</TD>
</TR>
<?
//connect as user
//global $_TABLES;
mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to display from
mysql_select_db("DB_EDITED_OUT");
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
$result = MYSQL_QUERY("SELECT accept, title, name, entree, shuttle, flight, transport, email, comments FROM {$_TABLES['gl_rsvp']}");
while ($A = DB_fetchArray($result)){
$retval .= '<p>' . $A['accept'] . '</p>';
}
return $retval;
?>
</TABLE>
It doesn't seem to function properly. Does anyone have any input? I'd be greatly appreciative of any help, thanks!
Text Formatted Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<title>RSVP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<SCRIPT LANGUAGE="Javascript">
function validate() {
if (!(rsvpform.accept[0].checked || rsvpform.accept[1].checked)) {
alert('Please select either Accept or Decline, thanks!');
event.returnValue=false;
}
else {
rNv=rsvpform.name.value;
if (rNv=='') {
alert('Please enter your name so we can properly track responses, thanks!');
event.returnValue=false;
}
}
}
</SCRIPT>
<?
//initilize PHP
//$_TABLES['gl_rsvp'] = $_DB_table_prefix . 'gl_rsvp';
if($_POST['submit']) //If submit is hit
{
//then connect as user
//change user and password to your mySQL name and password
//global $_TABLES;
//mysql_connect("localhost","user","password");
//mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to edit
mysql_select_db("DB_EDITED_OUT");
//convert all the posts to variables:
$rsvp_id = $_POST['rsvp_id'];
$accept = $_POST['accept'];
$title = $_POST['title'];
$name = $_POST['name'];
$entree = $_POST['entree'];
$title2 = $_POST['title2'];
$name2 = $_POST['name2'];
$entree2 = $_POST['entree2'];
$shuttle = $_POST['shuttle'];
$flight = $_POST['flight'];
$transport = $_POST['transport'];
$email = $_POST['email'];
$comments = $_POST['comments'];
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
$result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
if ($name2 != NULL) {
$result2=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title2', '$name2', '$entree2', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name3 != NULL) {
$result3=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title3', '$name3', '$entree3', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name4 != NULL) {
$result4=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title4', '$name4', '$entree4', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
if ($name5 != NULL) {
$result5=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title5', '$name5', '$entree5', '$shuttle', '$flight', '$transport', '$email', '$comments')");
}
//confirm
echo $name;
echo ", thank you for responding to our RSVP.";
if ($accept == 'Accept')
echo " We cannot wait to see you there!";
else
echo " Sorry you couldn't join us.";
}
else{
// close php so we can put in our code
?>
<form name="rsvpform" method="post" onsubmit="validate();" action="http://www.jeffandcrystal.com/rsvp/rsvp4.php">
<table style="border-collapse: separate;" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td width="253" colspan="2">
<input type="radio" value="Accept" name="accept">Accept with Pleasure</td>
<td width="731" colspan="2">
<input type="radio" value="Decline" name="accept">Decline with Regret</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3"> Names Of Those Attending In Your Party</td>
<td width="634">Desired Entree</td></tr>
<tr>
<td width="350" colspan="3">1. <select size="1" name="title">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name"></td>
<td width="634"><select size="1" name="entree">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">2. <select size="1" name="title2">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name2"></td>
<td width="634"><select size="1" name="entree2">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">3. <select size="1" name="title3">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name3"></td>
<td width="634"><select size="1" name="entree3">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">4. <select size="1" name="title4">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name4"></td>
<td width="634"><select size="1" name="entree4">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="350" colspan="3">5. <select size="1" name="title5">
<option value="Mr." selected="selected">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option></select>
<input type="text" size="35" value="" name="name5"></td>
<td width="634"><select size="1" name="entree5">
<option value="Pork" selected="selected">Pork Loin</option>
<option value="Beef">Roast Beef</option>
<option value="Veggie">Vegetarian</option>
<option value="Child">Children's Meal</option></select></td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require shuttle service from the airport to The Clarion Hotel?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="shuttle">Yes</td>
<td width="164">
<input type="radio" value="No" name="shuttle">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Flight Arrival Time:
<input type="text" size="15" value="" name="flight"></td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Will you require transportation from The Clarion Hotel to the Ceremony and back?</td></tr>
<tr>
<td width="89">
<input type="radio" value="Yes" name="transport">Yes</td>
<td width="164">
<input type="radio" value="No" name="transport">No</td><td width="97">
<p> </p>
</td><td width="634">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">
<p> </p>
</td></tr>
<tr>
<td width="984" colspan="4">Email Address (optional):
<input type="text" size="30" value="" name="email"></td></tr>
<tr>
<td width="350" colspan="3">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="350" colspan="3">Comments/Questions (optional):</td>
<td width="634">
<p> </p>
</td>
</tr>
<tr>
<td width="984" colspan="4"><textarea name="comments" rows="5" cols="60"> </textarea></td></tr>
<tr>
<td width="89">
<p> </p>
</td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr><tr>
<td width="89">
<input type="submit" value="submit" name="submit"></td>
<td width="164">
<p> </p>
</td>
<td width="97">
<p> </p>
</td>
<td width="634">
<p> </p>
</td>
</tr></tbody></table></form>
<?
} //close the else statement
?>
</body>
</html>
That code successfully loads all the data into my database correctly. Now, I'm trying to design a simple report that'll pull out the data and display it in a simple table format. Here's the code that I have so far:
Text Formatted Code
<TABLE><TR>
<TD>Accept</TD>
<TD>Title</TD>
<TD>Name</TD>
<TD>Entree</TD>
<TD>Shuttle</TD>
<TD>Flight</TD>
<TD>Transport</TD>
<TD>Email</TD>
<TD>Comments</TD>
</TR>
<?
//connect as user
//global $_TABLES;
mysql_connect("localhost",USER_EDITED_OUT,PWD_EDITED_OUT);
//select which database you want to display from
mysql_select_db("DB_EDITED_OUT");
//Insert the values into the correct database with the right fields
//mysql table = gl_rsvp
//table columns = rsvp_id, accept, title, name, entree, shuttle, flight, transport, email, comments
//post variables = $rsvp_id, $accept, $title, $name, $entree, $shuttle, $flight, $transport, $email, $comments
// $result=MYSQL_QUERY("INSERT INTO gl_rsvp (rsvp_id,accept,title,name,entree,shuttle,flight,transport,email,comments)"."VALUES ('NULL', '$accept', '$title', '$name', '$entree', '$shuttle', '$flight', '$transport', '$email', '$comments')");
$result = MYSQL_QUERY("SELECT accept, title, name, entree, shuttle, flight, transport, email, comments FROM {$_TABLES['gl_rsvp']}");
while ($A = DB_fetchArray($result)){
$retval .= '<p>' . $A['accept'] . '</p>';
}
return $retval;
?>
</TABLE>
It doesn't seem to function properly. Does anyone have any input? I'd be greatly appreciative of any help, thanks!
13
9
Quote
All times are EST. The time is now 11:42 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content