Link to home
Start Free TrialLog in
Avatar of chrisglissman
chrisglissman

asked on

How can I take my website form and store the entry's into a database that I can view online?

If you go to www.tothegreen.com and click on "submit a free instant quote" or http://tothegreen.com/quote.php - the data that you fill out to submit, i would like to take that data once the person clicks the submit button and store it in a database that I could view online.
Currently once you click the submit button the site sends an email to US and the person that submitted the quote, an email containing the quote information. I would like to keep it this way just add the database portion. I am including the current code we have for that page. Thanks in advance for your assistance.
<html>
 
	<head>
		<title>To The Green -// GPS GOLF CART UNIT QUOTE \\- GPS for Golf Carts</title>
		<meta http-equiv="imagetoolbar" content="no">
		<meta name="keywords" content="To The Greem,Digital caddy,digital caddie,distance measuring equipment,distance monitor,distances,distancing,Dogleg,download course map,Garmin,Geo-reference,Geospatial,Gift,Gift for Dad,Gift for Father,GIS,global positioning system,global positioning systems,Golf,golf balls,golf betting,golf cart,golf cart gps,golf club,golf course,golf course management,golf course mapping software,Golf course maps,Golf gift,golf glove,golf gps,golf pro,golf products,golf scoring,golf scorecard,golf shot tracking,golf map,golf technology,golf tools,golf tournament,golfer,golfing,GolfPS,GPS,GPS Caddy,GPS for iPaq,GPS for Palm,GPS receiver,Handheld,Handicap,HP,Hewlett Packard,Hewlett-Packard,iGolf,iGPS-SD,improve golf scores,IPAQ,Jim McLean,Jornada,Laser,Lay up,Layup,Lay-up,LinksPoint,Links Point,lower golf scores,Magellan,MapManager,Match play,Medal play,MobilePro,navigation,NEC,Palm V,PDA,Performance,PGA,PGA Tour,Pharos,play better,PocketPC,Rangefinder,satellite,score,Scorecard,shoot lower scores,SD GPS, SDIO GPS,Side bet,Sky Golf GPS,SkyGolf,SkyGolfGPS,SkyHawke,Software,Star Caddy,StarCaddy,StarCaddie,Tee,Toshiba,Total Score,tracking,tracking systems,travroute,tournament,upload course map,Urthere,USGA,vacation,Visor,WinCE,Yardage">
		<meta name="description" content="TO THE GREEN :: The Low Cost GPS System for golfers! Find the accurate distance to the green!">
		<meta name="robots" content="index,follow">
		<meta name="revisit" content="14 days">
		<meta name="distribution" content="Global">
		<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
		<link href="favicon.ico" rel="shortcut icon">
		<link href="style.css" type="text/css" rel="stylesheet" media="all">
		<style type="text/css">
<!--
BODY    { background-color: #558b1b; background-image: url(images/bg.jpg); background-repeat: repeat-x; scrollbar-3dlight-color: #4d8f09; scrollbar-arrow-color: #ffffff; scrollbar-base-color: #4d8f09; scrollbar-darkshadow-color: #4d8f09; scrollbar-face-color: #4d8f09; scrollbar-highlight-color: #4d8d09; scrollbar-shadow-color: #4d8f09; scrollbar-track-color: #87CD37   }
-->
</style>
	</head>
 
	<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false" bgcolor="#558b1b" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
		<div align="center">
			<table id="Table_01" border="0" cellpadding="0" cellspacing="0">
				<tr height="29">
					<td rowspan="3" width="54" height="238"><img src="images/top3_01.jpg" width="54" height="238" alt=""></td>
					<td colspan="2" width="799" height="29"><img src="images/top3_02.jpg" width="799" height="29" alt=""></td>
					<td rowspan="3" width="53" height="238"><img src="images/top3_03.jpg" width="53" height="238" alt=""></td>
				</tr>
				<tr height="204">
										<td bgcolor="#87cd37" width="554" height="204" background="images/top3_04.jpg">
						<div align="center">
							<font color="#b8e087"><img src="images/banner/rotate.php" alt="" height="204" width="554" border="0"></font></div>
					</td>
					<td bgcolor="#87cd37" width="245" height="204"><font color="#b8e087"><img src="images/banner_right/rotate.php" width="245" height="204" alt=""></font></td>
				</tr>
				<tr height="5">
					<td width="554" height="5"><img src="images/top3_06.jpg" width="554" height="5" alt=""></td>
					<td width="245" height="5"><img src="images/top3_07.jpg" width="245" height="5" alt=""></td>
				</tr>
			</table>
			<table id="Table_01" border="0" cellspacing="0" cellpadding="0">
				<tr height="12">
					<td width="54" height="12" background="images/middle_01.jpg"></td>
					<td bgcolor="#87cd37" width="253" height="12"></td>
					<td bgcolor="#87cd37" width="17" height="12"></td>
					<td bgcolor="#87cd37" width="529" height="12"></td>
					<td width="53" height="12" background="images/middle_05.jpg"></td>
				</tr>
				<tr height="327">
					<td valign="top" width="54" height="327" background="images/middle_01.jpg"></td>
					<td valign="top" bgcolor="#87cd37" width="253" height="327"><? include("menu.php") ?><br>
						<img src="images/blank1.jpg" alt="" height="87" width="253" border="0"><br>
						<br>
						<img src="images/blank2.jpg" alt="" height="87" width="253" border="0"><br>
						<!--To The Green digital GPS system, Golf Cart Tracking. electronic controllers, carpets, ac systems, custom golf carts, tires, wheels, rims, ez-go, club car, columbia, Yamaha, Bob Pudenz, Carroll Iowa, tothegreen.com, 1-866-792-9215--></td>
					<td valign="top" bgcolor="#87cd37" width="17" height="327"></td>
					<td valign="top" bgcolor="#558b1b" width="529" height="327"><img src="images/bigbar_quote.jpg" alt="" height="59" width="529" border="0">
						<table width="473" border="0" cellspacing="0" cellpadding="0" align="center">
							<tr>
								<td>
									<p>Fill out this form and we will send you an Instant Quote for the GPS Units for Golf Carts! (Please fill out ALL the items listed below)</p>
									<form onSubmit="return formCheck(this);" id="formcheck" action="quote_action.php" method="post" name="formcheck">
										<table border="0" cellspacing="2" cellpadding="2">
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Course Name:</td>
												<td valign="top" width="337" height="20"><input type="text" name="cname" size="45"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Course Address:</td>
												<td valign="top" width="337" height="20"><input type="text" name="caddress" size="45"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">eMail:</td>
												<td valign="top" width="337" height="20"><input type="text" name="email" size="45"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right">
															Phone:</div>
												</td>
												<td valign="top" width="337" height="20"><input type="text" name="phone" size="33"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right">
														City:</div>
												</td>
												<td valign="top" width="337" height="20"><input type="text" name="city" size="26"> </td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">State:</td>
												<td valign="top" width="337" height="20"><select name="state">
														<option value="AL">Alabama</option>
														<option value="AK">Alaska</option>
														<option value="AZ">Arizona</option>
														<option value="AR">Arkansas</option>
														<option value="CA">California</option>
														<option value="CO">Colorado</option>
														<option value="CT">Connecticut</option>
														<option value="DE">Delaware</option>
														<option value="DC">District of Columbia</option>
														<option value="FL">Florida</option>
														<option value="GA">Georgia</option>
														<option value="HI">Hawaii</option>
														<option value="ID">Idaho</option>
														<option value="IL">Illinois</option>
														<option value="IN">Indiana</option>
														<option value="IA">Iowa</option>
														<option value="KS">Kansas</option>
														<option value="KY">Kentucky</option>
														<option value="LA">Louisiana</option>
														<option value="ME">Maine</option>
														<option value="MD">Maryland</option>
														<option value="MA">Massachusetts</option>
														<option value="MI">Michigan</option>
														<option value="MN">Minnesota</option>
														<option value="MS">Mississippi</option>
														<option value="MO">Missouri</option>
														<option value="MT">Montana</option>
														<option value="NE">Nebraska</option>
														<option value="NV">Nevada</option>
														<option value="NH">New Hampshire</option>
														<option value="NJ">New Jersey</option>
														<option value="NM">New Mexico</option>
														<option value="NY">New York</option>
														<option value="NC">North Carolina</option>
														<option value="ND">North Dakota</option>
														<option value="OH">Ohio</option>
														<option value="OK">Oklahoma</option>
														<option value="OR">Oregon</option>
														<option value="PA">Pennsylvania</option>
														<option value="RI">Rhode Island</option>
														<option value="SC">South Carolina</option>
														<option value="SD">South Dakota</option>
														<option value="TN">Tennessee</option>
														<option value="TX">Texas</option>
														<option value="UT">Utah</option>
														<option value="VT">Vermont</option>
														<option value="VA">Virginia</option>
														<option value="WA">Washington</option>
														<option value="WV">West Virginia</option>
														<option value="WI">Wisconsin</option>
														<option value="WY">Wyoming</option>
													</select></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right">
														Zip:</div>
												</td>
												<td valign="top" width="337" height="20"><input type="text" name="zip" size="10"> </td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20"></td>
												<td valign="top" width="337" height="20"><br>
												</td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Contact me by:</td>
												<td valign="top" width="337" height="20"><select name="contact" size="1">
														<option selected value="phone">phone</option>
														<option value="email">email</option>
														<option value="do not contact me at this time">do not contact me at this time</option>
													</select></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20"><br>
												</td>
												<td valign="top" width="337" height="20">
													
												</td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Contact Name:</td>
												<td valign="top" width="337" height="20"><input type="text" name="name" size="45"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Course Season:</td>
												<td valign="top" width="337" height="20"><select name="season" size="1">
														<option value="6 months">6 months</option>
														<option value="8 months">8 months</option>
														<option selected value="12 months">12 months</option>
													</select></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20"># of holes:</td>
												<td valign="top" width="337" height="20"><input type="text" name="holes" size="4" maxlength="3"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Annual Cart Rounds:</td>
												<td valign="top" width="337" height="20"><input type="text" name="rounds" size="6" maxlength="5"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20"># of Carts:</td>
												<td valign="top" width="337" height="20"><input type="text" name="carts" size="4" maxlength="3"></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Power:</td>
												<td valign="top" width="337" height="20"><select name="power" size="1">
														<option SELECTED value="electric">electric</option>
														<option value="gas">gas</option>
														<option value="gas and electric">both</option>
													</select></td>
											</tr>
											
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">Made By:</td>
												<td valign="top" width="337" height="20"><select name="type" size="1">
														<option selected></option>
														<option value="Yamaha">Yamaha</option>
														<option value="Club Car">Club Car</option>
														<option value="EZ-GO">EZ-GO</option>
														<option value="Mix of carts">Mix of carts</option>
													</select></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20"></td>
												<td valign="top" width="337" height="20"><br>
												</td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right">Notes/Message:</div>
												</td>
												<td valign="top" width="337" height="20"><textarea name="note" rows="6" cols="51"></textarea></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right"><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" alt="captcha" />
</div>
												</td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">													
												<div align="right">Enter the security code above:</div>
												</td>
												<td width="337" height="20" valign="bottom"><input id="security_code" name="security_code" type="text" /></td>
											</tr>
											<tr height="20">
												<td colspan="2" align="center" height="20" style="color:#0000CC;font-size:10px;font-weight:bolder;"><?php if (isset($_GET['msg'])) echo $_GET['msg']; ?></td>
											</tr>
											<tr height="20">
												<td align="right" valign="top" width="119" height="20">
													<div align="right">
														<input type="hidden" name="subject" value="Instant Quote from ToTheGreen.com"></div>
												</td>
												<td width="337" height="20"><input type="image" src="images/button_g_submit.gif" alt=""></td>
											</tr>
										</table>
									</form>
								</td>
							</tr>
						</table>
						<br>
					</td>
					<td valign="top" width="53" height="327" background="images/middle_05.jpg"></td>
				</tr>
				<tr height="15">
					<td width="54" height="15" background="images/middle_01.jpg"></td>
					<td bgcolor="#87cd37" width="253" height="15"></td>
					<td bgcolor="#87cd37" width="17" height="15"></td>
					<td bgcolor="#87cd37" width="529" height="15"></td>
					<td width="53" height="15" background="images/middle_05.jpg"></td>
				</tr>
			</table>
			<table width="906" border="0" cellspacing="0" cellpadding="0" height="50">
				<tr>
						<td valign="bottom">
			<div align="center">
				<img src="images/bottom2.jpg" alt="" height="51" width="906"></div>
		</td>
				</tr>
			</table>
			<script language="JavaScript"><!--
/***********************************************
* Required fields validation
***********************************************/
 
function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("name", "email", "phone", "cname", "carts", "rounds", "holes");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("Contact Name", "Email", "Phone Number", "Course Name", "# of Carts", "Annual Cart Rounds", "Number of Course Holes");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}
 
	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//
//-->
</script>
		
			
 
	</body>
 
</html>

Open in new window

Avatar of CWS (haripriya)
CWS (haripriya)
Flag of India image

Hi,

The form on submission goes to the page quote_action.php
You should place your database insert code in quote_action.php page only.

Can you attach quote_action.php here?
Avatar of adammm89
adammm89

This script will require some fine tuning to get it to work correctly with your database, but should be pretty straight forward if you've dabbled in PHP before. I looped through the fields rather than going through them one by one and applying mysql_real_escape_string to each, simply just because there was so many.
<?php
 
/* Connect to database */
$db_conn = mysql_connect("__HOST__", "__USERNAME__", "__PASSWORD__");
mysql_select_db("__DB__", $db_conn) or die('Connection error: ' . mysql_error());
 
/* Build array of fields to filter */
$filter_fields = array(
    'cname', 'caddress', 'email', 'phone', 'city', 'state', 'zip',
    'contact', 'name', 'season', 'holes', 'rounds', 'carts',
    'type', 'note', 'security_code', 'subject', 'power'
);
 
/* Loop through the fields creating a variable with that field name 
   and filter the variable so they're safe to use in the MySQL query */
foreach ($filter_fields as $field)
{
    $$field = mysql_real_escape_string($field);
}
 
//
// Any customer validation you wish here
//
 
/* Query to insert data  */
$insert_data = mysql_query("
    INSERT INTO field_name
    VALUES ('{$cname}', '{$caddress}', '{$email}', '{$phone}', '{$city}', '{$state}', '{$zip}',
            '{$contact}', '{$name}', '{$season}', '{$holes}', '{$rounds}', '{$carts}', '{$type}',
            '{$note}', '{$security_code}', '{$subject}', '{$powder}')
") or die('Data insert error: ' . mysql_error());
 
/* Output the result to the user */
if ($insert_data)
{
    echo 'Sucessfully entered data!';
}
 
?>

Open in new window

Avatar of chrisglissman

ASKER

Would I add the above code to my quote.php code? I have very minimal knowledge of PHP and database work. I do have a the logins to my Control Panel and the website. Like I said I would love to view the data from a webpage once it starts collecting it.

I am attaching the quote_action.php code as well.

Thanks,
Chris
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<?
session_start();
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
$cname = $_POST['cname'];
$caddress = $_POST['caddress'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$contact = $_POST['contact'];
$name = $_POST['name'];
$season = $_POST['season'];
$holes = $_POST['holes'];
$rounds = $_POST['rounds'];
$carts = $_POST['carts'];
$type = $_POST['type'];
$power = $_POST['power'];
$note = $_POST['note'];
$time = $_POST['time'];
 
 
$ttlUnit1 = 0;
$ttlUnit2 = 0;
$ttlUnit3 = 0;
$ttlUnit4 = 0;
 
 
if ($carts < 30){
 $priceUnit1 = 389;
 $priceUnit2 = 0;
 $priceUnit3 = 0;
 $priceUnit4 = 0;
 $ttlUnit1 = number_format(($carts * $priceUnit1), 2);
 $ttlUnit2 = 'NOT AVAILABLE';
 $ttlUnit3 = 'NOT AVAILABLE';
 $ttlUnit4 = 'NOT AVAILABLE';
}else{
 $priceUnit1 = 389;
 $priceUnit2 = 689;
 $priceUnit3 = 989;
 $priceUnit4 = 989;
 $ttlUnit1 = number_format(($carts * $priceUnit1), 2);
 $ttlUnit2 = number_format(($carts * $priceUnit2), 2);
 $ttlUnit3 = number_format(($carts * $priceUnit3), 2);
 $ttlUnit4 = number_format((1 * $priceUnit4), 2);
} 
 
 
 
//if ($ttlUnit2 = 0){
// $ttlUnit2 = "Not Available";
//}else{
// $ttlUnit2 = '$'.ttlUnit2;
//}
$message ='<table width=537 border=0 cellspacing=10 cellpadding=5 bgcolor=#c0f09c height=475>
 <div align=center>
  <tr>
   <td valign=top bgcolor=#87cd37><br><br><br>
	<table cellpadding="0" cellspacing="0" border="0">
	 <tr>
	  <td>
		<table border=0 cellspacing=2 cellpadding=2 align=center>
		 <tr height=20>
		  <td width=179 height=20>
			<div align=right><font size=2 color=#4a7917 face=Verdana>Course Name:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$cname.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Contact:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$name.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Phone:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$phone.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Address:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$caddress.'</b></font></td>
		 </tr>
		 <tr height=20>
	      <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>City,&nbsp;State, Zip:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$city.', '.$state.' '.$zip.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
			<div align=right><font size=2 color=#4a7917 face=Verdana>eMail:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$email.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Best&nbsp;Contact Form:</font></div>
		  </td><td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$contact .'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 face=Verdana><br></font></div>
		  </td>
		  <td width=257 height=20></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Course Season:</font></div>
		  </td><td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$season.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Course Holes:</font></div>
		  </td><td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$holes.'</b></font></td>
		 </tr><tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Annual Cart Rounds:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$rounds.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>How Many Carts:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$carts.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
			<div align=right><font size=2 color=#4a7917 face=Verdana>Cart Power:</font></div>
		  </td>
		  <td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$power.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 color=#4a7917 face=Verdana>Type:</font></div>
		  </td><td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>'.$type.'</b></font></td>
		 </tr>
		 <tr height=20>
		  <td width=179 height=20>
		   <div align=right><font size=2 face=Verdana><br></font></div>
		  </td>
		  <td width=257 height=20></td>
		 </tr>
	    </table>
	  </td>
	 </tr>
	 <tr>
	  <td width="436"><font size=2 face=Verdana>Your quote is below.  Please note that pricing is in US Dollars and does not include applicable Sales Tax or Shipping Charges.  Pricing is subject to change.</font><br></td>
	 </tr>
	 <tr>
	  <td>
	   <table>
	    <tr height=20>
		 <td width=179 height=20>
		  <div align=right><font size=2 color=#4a7917 face=Verdana>'.$carts.' CSX GPS Unit (Non-Tracking) $389/ea :</font></div>
		</td>
		<td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>$'.$ttlUnit1.'</b></font></td>
	   </tr>
	   <tr height=20>
		<td width=179 height=20>
		 <div align=right><font size=2 color=#4a7917 face=Verdana>'.$carts.' CSX PRO GPS Unit (Tracking) $689/ea :</font></div>
		</td>
		<td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>$'.$ttlUnit2.'</b></font></td>
	   </tr>
	   <tr height=20>
		<td width=179 height=20>
		 <div align=right><font size=2 color=#4a7917 face=Verdana>'.$carts.' CTX PRO GPS Unit (Tracking) $989/ea :</font></div>
		</td>
		<td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>$'.$ttlUnit3.'</b></font></td>
	   </tr>
	   <tr height=20>
		<td width=179 height=20>
		 <div align=right><font size=2 color=#4a7917 face=Verdana>'.$carts.' Ranger or Beverage Unit (Tracking) $989/ea :</font></div>
		</td>
		<td bgcolor=#91dc3b width=257 height=20><font size=2 color=#003300 face=Verdana><b>$'.$ttlUnit4.'</b></font></td>
	   </tr>
	   
	   <tr height=20>
	    <td width=179 height=20><br></td>
		<td width=257 height=20></td>
	   </tr>
	   <tr height=20>
		<td colspan=2 width=442 height=20><font size=2 color=#003300 face=Verdana><b>Message: '.$note.'</b></font></td>
	   </tr>
	   <tr height=20>
	    <td width=179 height=20><br></td>
		<td width=257 height=20></td>
	   </tr>
	   <tr height=20>
		<td width=179 height=20><font size=1 color=#4a7917 face=Verdana>Sent from IP: '.$REMOTE_ADDR.'</font></td>
		<td width=257 height=20>
		 <div align=right><font size=1 color=#4a7917 face=Verdana>www.ToTheGreen.com</font></div>
		</td>
	   </tr>
	  </table>
	  </td>
     </tr>
    </table>
  </td>
 </tr>
</div>
</table>
<img src=http://www.tothegreen.com/images/quote_head.jpg alt= height=154 height=182 width=471 border=0>';
 
$to="ToTheGreen.com <Quote@ToTheGreen.com>";
$from="$email";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: $from\r\n";
mail($to, $subject, $message, $headers);
 
$message='<table width=537 border=0 cellspacing=10 cellpadding=5 bgcolor=#c0f09c height=475>
			<tr>
				<td valign=top bgcolor=#87cd37>
			<div align=center>
				<br>
				<img src=http://www.tothegreen.com/images/quote_head.jpg alt= height=154 height=182 width=471 border=0><br>
				<br>
				<table border=0 cellspacing=2 cellpadding=2 align=center>
					<tr height=20>
						<td colspan=2 width=444 height=20>
							<p><font size=2 color=#003300 face=Verdana>'.$name.' -<br>
									Thank you for submitting for an Instant Quote from To The Green! By telling us <b>you have '.$carts.' '.$power.' '.$type.' carts</b> with <b>'.$rounds.' annual cart rounds</b> we calculated your total below:</font></p>
						</td>
					</tr>
					<tr height=20>
						<td width=290 height=20><br>
						</td>
						<td width=148 height=20></td>
					</tr>
					<tr height=20>
						<td colspan=2 width=444 height=20>
							<div align=right>
								<font size=2 color=#4a7917 face=Verdana>'.$carts.' Digital Yardage Locators Installed:</font><font size=2 face=Verdana><br>
								</font></div>
						</td>
					</tr>
					<tr height=20>
						<td width=290 height=20>
							<div align=right>
								<font size=2 color=#003300 face=Verdana>CSX GPS Unit (Non-Tracking) $389/ea </font></div>
						</td>
						<td bgcolor=#91dc3b width=148 height=20><font size=2 color=#003300 face=Verdana><b>'.$ttlUnit1.'</b> </font></td>
					</tr>
					<tr height=20>
						<td width=290 height=20>
							<div align=right>
								<font size=2 color=#003300 face=Verdana>CSX PRO GPS Unit (Tracking) $689/ea </font></div>
						</td>
						<td bgcolor=#91dc3b width=148 height=20><font size=2 color=#003300 face=Verdana><b>'.$ttlUnit2.'</b> </font></td>
					</tr>
					<tr height=20>
						<td width=290 height=20>
							<div align=right>
								<font size=2 color=#003300 face=Verdana>CTX PRO GPS Unit (Tracking) $989/ea </font></div>
						</td>
						<td bgcolor=#91dc3b width=148 height=20><font size=2 color=#003300 face=Verdana><b>'.$ttlUnit3.'</b> </font></td>
					</tr>
					<tr height=20>
						<td width=290 height=20>
							<div align=right>
								<font size=2 color=#003300 face=Verdana>Ranger or Beverage Unit (Tracking) $989/ea </font></div>
						</td>
						<td bgcolor=#91dc3b width=148 height=20><font size=2 color=#003300 face=Verdana><b>'.$ttlUnit4.'</b> </font></td>
					</tr>
					<tr height=20>
						<td width=290 height=20><br>
						</td>
						<td width=148 height=20></td>
					</tr>
					<tr height=20>
						<td width=290 height=20>
							<div align=right>
								<br>
							</div>
						</td>
						<td width=148 height=20></td>
					</tr>
					<tr height=14>
						<td colspan=2 width=444 height=14><font size=2 color=#003300 face=Verdana>Prices are in US Dollars and do not include shipping or applicable taxes.<br>
								<br>
								We offer flexible payment plans depending on your golf season.<br>
								If you have ANY questions please feel free to give us a call.<br>
								<b>1-866-792-9215</b></font></td>
					</tr>
					<tr height=14>
						<td width=290 height=14><br>
						</td>
						<td width=148 height=14></td>
					</tr>
					<tr height=14>
						<td colspan=2 width=444 height=14>
							<div align=right>
								<font size=1 color=#4a7917 face=Verdana><b>To&nbsp;The Green</b></font></div>
						</td>
					</tr>
					<tr height=14>
						<td colspan=2 width=444 height=14>
							<div align=right>
								<font size=1 color=#4a7917 face=Verdana>www.ToTheGreen.com</font></div>
						</td>
					</tr>
				</table>
			</div>
		</td>
			</tr>
		</table>';
 
 
$to="$email";
$from="To The Green <Quote@ToTheGreen.com>";  
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: $from\r\n";
mail($to, $subject, $message, $headers);
unset($_SESSION['security_code']);
echo "<script language=\"JavaScript\">
 			self.location=\"quote_submitted.php\";
 			</script>"; 
} else {
   echo "<script language=\"JavaScript\">
 			self.location=\"quote.php?msg=The security code you entered was incorrect.  Please try again.\";
 			</script>"; 
}
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of CWS (haripriya)
CWS (haripriya)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
use the below sql command.
CREATE TABLE `greenquote` (
`cname` VARCHAR( 100 ) NOT NULL ,
`caddress` VARCHAR( 200 ) NOT NULL ,
`email` VARCHAR( 100 ) NOT NULL ,
`phone` VARCHAR( 25 ) NOT NULL ,
`city` VARCHAR( 50 ) NOT NULL ,
`state` VARCHAR( 50 ) NOT NULL ,
`zip` VARCHAR( 10 ) NOT NULL ,
`contact` VARCHAR( 100 ) NOT NULL ,
`name` VARCHAR( 100 ) NOT NULL ,
`season` VARCHAR( 100 ) NOT NULL ,
`holes` VARCHAR( 50 ) NOT NULL ,
`rounds` VARCHAR( 50 ) NOT NULL ,
`carts` VARCHAR( 50 ) NOT NULL ,
`type` VARCHAR( 50 ) NOT NULL ,
`power` VARCHAR( 50 ) NOT NULL ,
`note` TEXT NOT NULL ,
`time` VARCHAR( 50 ) NOT NULL 
) ENGINE = MYISAM  

Open in new window

I have set up the database. and changed the page. now how do i veiw the data from a web page?
I think I have answered his original question in comment id #23741887