Forum Moderators: coopster
<!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" />
<title>Member Enrollment</title>
<link href="../2IGMainLight.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../includes/Creative_Menus/menuDisplay.js"></script>
<script type="text/javascript" src="../../includes/Creative_Menus/swfobject.js"></script>
</head>
<body>
<div id="container">
<?php include('templates/header.html'); ?>
<div id="main5" class="enroll">
<div id="seperate2" class="fontgreen14">
<p>This is were text can be put to outline the basic benefits for the membership. Pernatem di ut aut as que nima dit lignimusdae pra nis eum aut ut unt arum et enectati dolupti busapictum as quam fuga. Itae non pelliquate verovit empeliae. Arum endis dolluptas eossequi quunt laut ommolendi core cus sum num quunt quam, suntiosam eum non et volorrumquis dus, optatem ut laccusam, sunt.
Caerit fuga. Nam et fugit modi conemquos dolorae. Nam rectotatque es sunt ex exerae list.
<ul>
<li class="bulletTab">Et eos dicaepe ritatecus suntio
</li>
<li class="bulletTab">st
quis que maximus eos nobisquamet laborio </li>
<li class="bulletTab">Riore pa que elentin verunt. Untium inctur sequae erciae</li>
<li class="bulletTab">Et eos dicaepe ritatecus suntio
</li>
<li class="bulletTab">st
quis que maximus eos nobisquamet laborio </li>
<li class="bulletTab">Riore pa que elentin verunt. Untium inctur sequae erciae </li>
</ul>
</div>
<div class="main4">
<h1 class="ltgraygreen"><br />
2 Iron Golf Participating Facility Enrollment<br />
<br /></h1>
</div>
<div>
<?
function error_bool($error, $field) {
if($error[$field]) {
print("<td colspan='3' class='tableindentERROR'>");
}
else {
print("<td colspan='3' class='tableindent'>");
}
}
function show_form() {
global $HTTP_POST_VARS, $print_again, $error;
?>
<form method="post" action="" class="mem_table" >
<table width="600" border="0" cellspacing="0" cellpadding="4">
<!--Golf Facility Information -->
<tr>
<td colspan="5" class="tableHeader">Enter the golf facility's information</td>
</tr>
<tr>
<?php error_bool($error, "GFacilityName"); ?> Golf Facility:</td>
<td colspan="2"><input name="GFacilityName" type="text" value="<? echo $_POST["GFacilityName"]; ?>" class="fieldtext" id="GFacilityName" accesskey="g" tabindex="1" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's Address Line 1:</td>
<td colspan="2"><input name="GFAddress1" type="text" value="<?php $_POST[GFAddress1]; ?>" class="fieldtext" id="gfAddress1" accesskey="a" tabindex="2" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's Address Line 2:</td>
<td colspan="2"><input name="GFAddress2" type="text" value="<?php $_POST[GFAddress2]; ?>" class="fieldtext" id="gfAddress2" accesskey="a" tabindex="3" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's City:</td>
<td colspan="2"><input name="GFCity" type="text" value="<?php $_POST[GFCity]; ?>" class="fieldtext" id="gfCity" accesskey="c" tabindex="4" size="30" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's State:</td>
<td colspan="2">
<?php
$states_arr = array('AL'=>"Alabama",'AK'=>"Alaska",'AZ'=>"Arizona",'AR'=>"Arkansas",'CA'=>"California",'CO'=>"Colorado",'CT'=>"Connecticut",'DE'=>"Delaware",'DC'=>"District Of Columbia",'FL'=>"Florida",'GA'=>"Georgia",'HI'=>"Hawaii",'ID'=>"Idaho",'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas",'KY'=>"Kentucky",'LA'=>"Louisiana",'ME'=>"Maine",'MD'=>"Maryland", 'MA'=>"Massachusetts",'MI'=>"Michigan",'MN'=>"Minnesota",'MS'=>"Mississippi",'MO'=>"Missouri",'MT'=>"Montana",'NE'=>"Nebraska",'NV'=>"Nevada",'NH'=>"New Hampshire",'NJ'=>"New Jersey",'NM'=>"New Mexico",'NY'=>"New York",'NC'=>"North Carolina",'ND'=>"North Dakota",'OH'=>"Ohio",'OK'=>"Oklahoma", 'OR'=>"Oregon",'PA'=>"Pennsylvania",'RI'=>"Rhode Island",'SC'=>"South Carolina",'SD'=>"South Dakota",'TN'=>"Tennessee",'TX'=>"Texas",'UT'=>"Utah",'VT'=>"Vermont",'VA'=>"Virginia",'WA'=>"Washington",'WV'=>"West Virginia",'WI'=>"Wisconsin",'WY'=>"Wyoming");
?>
<?php
function showOptionsDrop($array){
$string = '';
foreach($array as $k => $v){
$string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n";
}
return $string;
}
?>
<select name="GFState" class="fieldtext">
<option value="0">Choose a state</option>
<?php echo showOptionsDrop($states_arr); ?>
</select></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's Zip Code:</td>
<td colspan="2"><input name="GFZip" type="text" value="<?php $_POST[GFZip]; ?>" class="fieldtext" id="gfZip" accesskey="z" tabindex="5" size="12" maxlength="12" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent"> Golf Facility's Phone 1:</td>
<td colspan="2"><input name="GFPhone1" type="text" value="<?php $_POST[GFPhone1]; ?>" class="fieldtext" id="gfPhone1" accesskey="p" tabindex="6" width="150" size="16" maxlength="16" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent"> Golf Facility's Phone 2:</td>
<td colspan="2"><input name="GFPhone2" type="text" value="<?php $_POST[GFPhone2]; ?>" class="fieldtext" id="gfPhone2" accesskey="p" tabindex="7" width="150" size="16" maxlength="16" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Golf Facility's Website:</td>
<td colspan="2"><input name="GFWebsite" type="text" value="<?php $_POST[GFWebsite]; ?>" class="fieldtext" id="gfWebsite" accesskey="w" tabindex="8" size="50" maxlength="100" /></td>
</tr>
<!--Golf Facility Contact information -->
<tr>
<td colspan="5" class="tableHeader">Enter your contact info</td>
</tr>
<tr>
<td colspan="3" class="tableindent">First Name:</td>
<td colspan="2"><input name="First" type="text" value="<?php $_POST[First]; ?>" class="fieldtext" id="First" accesskey="f" tabindex="9" size="30" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Last Name:</td>
<td colspan="2"><input name="Last" type="text" value="<?php $_POST[Last]; ?>" class="fieldtext" id="gfLast" accesskey="l" tabindex="10" size="30" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Title / Position:</td>
<td colspan="2"><input name="Title" type="text" value="<?php $_POST[Title]; ?>" class="fieldtext" id="gftitle" accesskey="t" tabindex="11" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Address Line 1:</td>
<td colspan="2"><input name="Address1" type="text" value="<?php $_POST[Address1]; ?>" class="fieldtext" id="gfAddress1" accesskey="a" tabindex="12" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Address Line 2:</td>
<td colspan="2"><input name="Address2" type="text" value="<?php $_POST[Address2]; ?>" class="fieldtext" id="gfAddress2" accesskey="a" tabindex="13" size="50" maxlength="100" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">City:</td>
<td colspan="2"><input name="City" type="text" value="<?php $_POST[City]; ?>" class="fieldtext" id="gfCity" accesskey="c" tabindex="14" size="30" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">State:</td>
<td colspan="2">
<select name="State" class="fieldtext">
<option value="0">Choose a state</option>
<?php echo showOptionsDrop($states_arr); ?>
</select></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Zip Code:</td>
<td colspan="2"><input name="Zip" type="text" value="<?php $_POST[Zip]; ?>" class="fieldtext" id="gfZip" accesskey="z" tabindex="15" size="12" maxlength="12" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent"> Phone 1:</td>
<td colspan="2"><input name="Phone1" type="text" value="<?php $_POST[Phone1]; ?>" class="fieldtext" id="gfPhone1" accesskey="p" tabindex="16" width="150" size="16" maxlength="16" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent"> Phone 2:</td>
<td colspan="2"><input name="Phone2" type="text" value="<?php $_POST[Phone2]; ?>" class="fieldtext" id="gfPhone2" accesskey="p" tabindex="17" width="150" size="16" maxlength="16" /></td>
</tr>
<tr>
<?php error_bool($error, "Email"); ?> E-mail Address:</td>
<td colspan="2"><input name="Email" type="text" value="<? echo $_POST["Email"]; ?>" class="fieldtext" id="Email" accesskey="e" tabindex="18" size="50" maxlength="100" /></td>
</tr>
<!--Create Username/password -->
<tr>
<td colspan="5" class="tableHeader">Enter your desired username and create your password</td>
</tr>
<tr>
<td height="35" colspan="3" class="tableindent">Username:</td>
<td colspan="2"><input name="Username" type="text" value="<?php $_POST[Username]; ?>" class="fieldtext" id="gfUsername" accesskey="u" tabindex="19" size="50" maxlength="50" /></td>
</tr>
<tr>
<td colspan="3" class="tableindent">Password:</td>
<td colspan="2">
<input name="Password" type="password" value="<?php $_POST[Password]; ?>" class="fieldtext" id="gfPassword1" accesskey="u" tabindex="20" size="50" maxlength="50" />
</td>
</tr>
<tr>
<td colspan="3" class="tableindent">Password Confirmation:</td>
<td colspan="2">
<input name="Password2" type="password" class="fieldtext" id="gfPassword2" accesskey="u" tabindex="21" size="50" maxlength="50" />
</td>
</tr>
<tr>
<td colspan="5" class="tableindent"><input name="Authorized" type="checkbox" value="1" id="tweet" checked="checked" />
Yes, I am authorized to sign up our golf facility with 2 Iron Golf's Participating Golf Facilities!</td>
</tr>
<tr>
<td colspan="5" class="tableindent"><input name="RecEmails" type="checkbox" value="1" id="gfnews" checked="checked" />
Yes, I would like to receive emails and news from 2 Iron Golf!</td>
</tr>
<tr>
<td colspan="5" class="tableHeader">Click "Register" to create your new account. </td>
</tr>
<tr>
<td width="20" class="tableindent2"> </td>
<td width="82"><input type="submit" name="submit" id="submit" value="Register" /></td>
<td width="54"><input type="submit" name="cancel1" id="cancel1" value="Cancel" /></td>
<td colspan="2" class="fontgray12noindent">Reset this <a href="<?php echo $HTTP_SERVER_VARS['PHP_SELF']; ?>">form</a>.</td>
</tr>
<tr>
<td class="tableindent2"> </td>
<td> </td>
<td> </td>
<td colspan="2" class="fontgray12noindent"> </td>
</tr>
</table>
</form>
<?
}
if(isset($_POST["submit"])) {
check_form();
} else {
show_form();
}
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
function check_form()
{
global $HTTP_POST_VARS, $error, $print_again;
$error['GFacilityName'] = false;
if($_POST["GFacilityName"]=="") {
$error['GFacilityName'] = true;
$print_again = true;
$message="The name field is empty<br>";
}
if(!check_email_address($_POST['Email'])) {
$error['Email'] = true;
$print_again = true;
$message.="Either Field Empty or Invalid Email ID <br>";
}
if($print_again) {
show_form();
} else {
header('Location:insertGFinfo.php');
}
echo "$message";
}
?>
<?php include('templates/footer.html'); ?>
</div>
</div>
</div> <!-- Container end -->
</body>
</html>
<?
$username="myusername";
$password="mypassword";
$database="mydatabase";
$servername = "myservername";
//Golf Facility info
$GFacilityName=$_POST['GFacilityName'];
$GFAddress1=$_POST['GFAddress1'];
$GFAddress2=$_POST['GFAddress2'];
$GFCity=$_POST['GFCity'];
$GFState=$_POST['GFState'];
$GFZip=$_POST['GFZip'];
$GFPhone1=$_POST['GFPhone1'];
$GFPhone2=$_POST['GFPhone2'];
$GFWebsite=$_POST['GFWebsite'];
//Golf Facility Contact info
$First=$_POST['First'];
$Last=$_POST['Last'];
$Title=$_POST['Title'];
$Address1=$_POST['Address1'];
$Address2=$_POST['Address2'];
$City=$_POST['City'];
$State=$_POST['State'];
$Zip=$_POST['Zip'];
$Phone1=$_POST['Phone1'];
$Phone2=$_POST['Phone2'];
$Email=$_POST['Email'];
$Username=$_POST['Username'];
$Password=$_POST['Password'];
$Authorized=$_POST['Authorized'];
$RecEmails=$_POST['RecEmails'];
//connect to the database
$connect=mysql_connect($servername,$username,$password);
mysql_select_db($database, $connect) or die ("Database not selected : " . mysql_error());
$queryGF = "INSERT INTO GFFacility (GFacilityName, GFAddress1, GFAddress2, GFCity, GFState, GFZip, GFPhone1, GFPhone2, GFWebsite)
VALUES('$GFacilityName','$GFAddress1','$GFAddress2','$GFCity','$GFState','$GFZip','$GFPhone1','$GFPhone2','$GFWebsite')";
$queryGFC = "INSERT INTO GFacilityContact (First, Last, Title, Address1, Address2, City, State, Zip, Phone1, Phone2, Email, Username, Password, Authorized, RecEmails)
VALUES('$First','$Last','$Title','$Address1','$Address2','$City','$State','$Zip','$Phone1','$Phone2','$Email','$Username','$Password','$Authorized','$RecEmails')";
// run the query for Golf Facility
$return1=mysql_query($queryGF);
if($return1){echo " Command is successful ";}
else
{echo "Command is not successful ";}
echo mysql_error();
// run the query for Golf Facility Contact
$return2=mysql_query($queryGFC);
if($return2){echo " Command is successful ";}
else
{echo "Command is not successful ";}
echo mysql_error();
mysql_close($connect);
include('gf_enroll_pg2Light.php');
?>
<!-- include your own success html here -->
function check_form () {
$myErrors = null;
// go through the list . . .
if ([some error]) {
$myErrors .= "<li>The so and so is in the wrong format.</li>";
}
return $myErrors;
}
$errors=null;
if(isset($_POST["submit"])) {
$errors =check_form();
if ($errors) { show_form($errors); }
// The previous should exit, no else required
add_database_update_here();
add_response_page_here();
} else {
show_form();
}
function show_form ($errorList=null) {
// =null makes it optional for first call
if ($errorList) {
// output your errors, populate the form vars
// that were previously input.
echo "<ul>$errorList</ul>";
}
}