Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Databasing
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 09-24-2009, 03:16 AM
  #1
drewrox
Novice (Level 1)
 
Join Date: Sep 2009
Posts: 7
iTrader: (0)
drewrox is an unknown quantity at this point
Wedding Reservations

Hello, this is my first post here so please bear with my newbness.

First a little background:

I am getting married soon and I am trying to make it so that guests can RSVP online. I have been studying HTML, PHP, and mysql for the last few days so that I can make this happen. I have NO background in any of these things except what I have taught myself online in order to make my wedding website and to try to do this online reservation thing.

I have an account with godaddy.com. My website is not hosted with them but I have a mysql database hosted through them.

Basically what I have done so far is created a form for people to fill out. What I have not been able to successfully do is make it so that when the "submit" button is pushed the data is sent to a table in my mysql database.

I'm not even sure that I know how to connect to the database through a webpage.. anyways, I am going to post what I have and would appreciate it if someone could tell me where to go from here.

How do I go from this to submitting this to my database?

Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN" "http://www.w3.org/TR/html4/loose.dtd">

<?php
$attending = $_POST["attending"];
$numberguests = $_POST["numberguests"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$emailaddress = $_POST["emailaddress"];
if (!isset($_POST['submit'])) {
?>
<html>

<head>
<title>Wedding Reservations</title>
<script>
var p=confirm("The reservation process is password protected. The password is located on the wedding invitation you received in the mail. Do you have the password?")
if(p){
var ans="5302010"
var pass=prompt("Please enter the password.")
if(pass!==ans)
{
alert("Sorry, that is incorrect. Please try again. If you are unable to gain access to the reservation page please contact me at andrew.scott.dale@gmail.com.")
//wrong
window.location="http://www.drewandjess.net"
}else{alert("Thank you!");}
}else{window.location="http://www.drewandjess.net"}
</script>


</head>
<body>



<form method="post" action="<?php WHATGOESHERE???? ;?>">

Will you be attending the wedding?
<br />
<input type="radio" name="attending" value="Yes" /> Yes
<br />
<input type="radio" name="attending" value="No" /> No
<br /><br />


Including yourself, how many guests will be in your party?

<select name="numberguests">
<option value="oneguest">1</option>
<option value="twoguests: selected="selected">2</option>
<option value="threeguests">3</option>
<option value="fourguests">4</option>
<option value="fiveguests">5</option>
<option value="sixguests">6</option>
<option value="sevenguests">7</option>
<option value="eightguests">8</option>
<option value="nineguests">9</option>
<option value="tenguests">10</option>

</select>

<br />
First name:
<input type="text" name="firstname" />
<br />
Last name:
<input type="text" name="lastname" />
<br />
Email Address:
<input type="text" name="emailaddress" />
<br /><br />
<input type="submit" value="Submit Your Reservation!" name="submitbutton">
</form>





</body>
</html>

Thanks in advance guys.

Drew
drewrox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-24-2009, 03:59 AM
  #2
drewrox
Novice (Level 1)
 
Join Date: Sep 2009
Posts: 7
iTrader: (0)
drewrox is an unknown quantity at this point
Decided to get rid of some of the extras that have nothing to do with my question..

Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN" "http://www.w3.org/TR/html4/loose.dtd">

<?php
$attending = $_POST["attending"];
$numberguests = $_POST["numberguests"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$emailaddress = $_POST["emailaddress"];
if (!isset($_POST['submit'])) {
?>
<html>
<head>
<title>Wedding Reservations</title>
</head>
<body>

<form method="post" action="<?php WHATGOESHERE???? ;?>">

Will you be attending the wedding?
<br />
<input type="radio" name="attending" value="Yes" /> Yes
<br />
<input type="radio" name="attending" value="No" /> No
<br /><br />

Including yourself, how many guests will be in your party?

<select name="numberguests">
<option value="oneguest">1</option>
<option value="twoguests: selected="selected">2</option>
<option value="threeguests">3</option>
<option value="fourguests">4</option>
<option value="fiveguests">5</option>
<option value="sixguests">6</option>
<option value="sevenguests">7</option>
<option value="eightguests">8</option>
<option value="nineguests">9</option>
<option value="tenguests">10</option>

</select>

<br />
First name:
<input type="text" name="firstname" />
<br />
Last name:
<input type="text" name="lastname" />
<br />
Email Address:
<input type="text" name="emailaddress" />
<br /><br />
<input type="submit" value="Submit Your Reservation!" name="submitbutton">
</form>

</body>
</html>
drewrox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-24-2009, 06:25 AM
  #3
prasanthmj
Fighter (Level 4)
 
Join Date: Aug 2009
Posts: 34
iTrader: (0)
prasanthmj is an unknown quantity at this point
The following tutorials might be helpful:
PHP form tutorial

PHP form processing

How to get email from html form submission
prasanthmj is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-25-2009, 11:01 PM
  #4
drewrox
Novice (Level 1)
 
Join Date: Sep 2009
Posts: 7
iTrader: (0)
drewrox is an unknown quantity at this point
Thank you for those links. Much better than the tutorials I used on w3 =]
drewrox is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 04:53 PM
  #5
misheck
Fighter (Level 4)
 
Join Date: Nov 2008
Posts: 37
iTrader: (0)
misheck is an unknown quantity at this point
I am also new to programing but I would have a mysql table that would consist of id, first_name, last_name,email_address,contact, number_of_guest (default 1), reserved(0) the I would have a PHP query that would insert the values to the database. Which would be (I have used an example of variables randomly and the ID will be auto_increment so you do not need to enter any data in that column.

Code:
$query = mysql_query(INSERT INTO 'wedding' VALUES( $firstname, $lastname,$emailaddress, $contact,$numberofguest, $reserved)) or die("error querying database". mysql_error())
I would be glad to help if you need help so just PM if u need help.
misheck is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 05:18 PM
  #6
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
Quote:
Originally Posted by misheck View Post
I am also new to programing but I would have a mysql table that would consist of id, first_name, last_name,email_address,contact, number_of_guest (default 1), reserved(0) the I would have a PHP query that would insert the values to the database. Which would be (I have used an example of variables randomly and the ID will be auto_increment so you do not need to enter any data in that column.

Code:
$query = mysql_query(INSERT INTO 'wedding' VALUES( $firstname, $lastname,$emailaddress, $contact,$numberofguest, $reserved)) or die("error querying database". mysql_error())
I would be glad to help if you need help so just PM if u need help.
Don't wanna be nit picking but inserting anything without proper escaping is now wise. Your query should also fail because number of values to be inserted don't match the column count (as you left the id out without telling the columns where you would insert data beforehand).
Well it was only an example but watewa
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 05:29 PM
  #7
misheck
Fighter (Level 4)
 
Join Date: Nov 2008
Posts: 37
iTrader: (0)
misheck is an unknown quantity at this point
It was just an example just to give an idea of how I would do it have a table and grab the variables from $_POST and insert them into the DB. Its just part of the query. I would definitely escape the variables when I m defining them. Sorry for giving poor help but thankfully you we all there on the forum to help each other out.
misheck is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 04:15 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.