Hi, no the page doesn't involve a cart whatsoever, I would probably add that functionality later though. Here is the packages page that gets the stuff from the db.
PHP Code:
<html>
<title>Kite Surfing Safaris</title>
<head>
<link href="../includes/css.css" rel="stylesheet" type="text/css" />
</head>
<body><marquee><div align="center" style="color:#ffffff; font-
size:18px;">KiteSurfingSafaris</div></marquee>
<div id="kiteboarder"></div>
<?php include("menu_top.html"); ?>
<table width="640px" height="100%" align="center" valign="top" id="content"
border="0px"><tr><td valign="top"><div style="color:#ff9900; font-size:18px;"><h3
style="color:#800000;">Packages</h3>
<?php
// Make a MySQL Connection
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("products") or die(mysql_error());
// Get all the data from the "package" table
$result = mysql_query("SELECT * FROM package")
or die(mysql_error());
echo "<center><table border='1'>";
echo "<tr bgcolor='#ffff99'><th>Name</th> <th>Description</th><th>Price</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['p_name'];
echo "</td><td>";
echo $row['p_description'];
echo "</td><td>$";
echo $row['p_price'];
echo "</td><td><div><a href='#'>Inquire</a></div>";
echo "</td></tr>";
}
echo "</table></center>";
?>
</td></tr></table></div></body>
</html>
The following is the contact page
PHP Code:
<?php
define("EMAIL", "youremail@yourdomain.com");
if(isset($_POST['submit'])) {
include('validate.class.php');
//assign post data to variables
$fname = trim($_POST['firstname']);
$lname = trim($_POST['lastname']);
$email = trim($_POST['email']);
$message = trim($_POST['message']);
//start validating our form
$v = new validate();
$v->validateStr($fname, "first name", 3, 75);
$v->validateStr($lname, "last name", 3, 75);
$v->validateEmail($email, "email");
$v->validateStr($message, "message", 5, 1000);
if(!$v->hasErrors()) {
$header = "From: $email\n" . "Reply-To: $email\n";
$subject = "Contact Form Subject";
$email_to = EMAIL;
$emailMessage = "First Name: " . $fname . "Last Name: " . $lname . "\n";
$emailMessage .= "Email: " . $email . "\n\n";
$emailMessage .= $message;
//use php's mail function to send the email
@mail($email_to, $subject ,$emailMessage ,$header );
//grab the current url, append ?sent=yes to it and then redirect to that url
$url = "http". ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
header('Location: '.$url."?sent=yes");
} else {
//set the number of errors message
$message_text = $v->errorNumMessage();
//store the errors list in a variable
$errors = $v->displayErrors();
//get the individual error messages
$fnameErr = $v->getError("first name");
$lnameErr = $v->getError("last name");
$emailErr = $v->getError("email");
$messageErr = $v->getError("message");
}//end error check
}// end isset
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow"/>
<title>Kite Surfing Safaris</title>
<link href="../includes/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="kiteboarder"></div>
<?php include("menu_top.html"); ?>
<table width="50%" height="100%" align="center" valign="top" id="content" border="0px"><tr><td valign="top"> <p><div style="color:#ff9900; font-size:18px;"><a href="mailto:sales@kitesurfingsafaris.com.au">sales@kitesurfingsafaries.com.au</a><br/>If you would like to inquire about our services please fill in the form below with your details and we will get in touch with you as quickly as possible.</div></p><br/>
<div id="contact_form_wrap"><fieldset><legend>Contact Us</legend>
<span class="message"><?php echo $message_text; ?></span>
<?php echo $errors; ?>
<?php if(isset($_GET['sent'])): ?><h2>Your message has been sent</h2><?php endif; ?>
<form id="contact_form" method="post" action="/contact3.php">
<p><label>First Name:<br />
<input type="text" name="firstname" class="textfield" value="<?php echo htmlentities($fname); ?>" />
</label><br /><span class="errors"><?php echo $fnameErr; ?></span></p>
<p><label>Last Name:<br />
<input type="text" name="lastname" class="textfield" value="<?php echo htmlentities($lname); ?>" />
</label><br /><span class="errors"><?php echo $lnameErr; ?></span></p>
<p><label>Email: <br />
<input type="text" name="email" class="textfield" value="<?php echo htmlentities($email); ?>" />
</label><br /><span class="errors"><?php echo $emailErr ?></span></p>
<p><label>Message: <br />
<textarea name="message" class="textarea" cols="45" rows="5"><?php echo htmlentities($message); ?></textarea>
</label><br /><span class="errors"><?php echo $messageErr ?></span></p>
<p><input type="submit" name="submit" class="button" value="Submit" /></p>
</form>
</fieldset>
</div>
</td></tr>
</table>
</body>
</html>