Online Subscription Form

// Work around register_globals
reset($_POST);
while (list($name,$val) = each($_POST)) {
$$name = $val;
}

if ($next) {

// Check for required fields

$ErrMsg = "";

if (! $name) { $ErrMsg .= "Please enter your Modern Name
"; }
if (! $scaname) { $ErrMsg .= "Please enter your SCA Name
"; }
if ($ossub || $ossets) {

// Check for group camping with

if (! $group) { $ErrMsg .= "Please enter the name of the group you are camping with
"; }

}

if ($msetsus || $msetsca) {

// Check for mailing address

if (! $address1 || ! $city || ! $state || ! $postalcode || ! $country) {

$ErrMsg .= "Please enter your complete mailing address
";

}

}
if (! $ossub && ! $ossets && ! $msetsus && ! $msetsca && ! $pdfsets) {

$ErrMsg .= "Please choose at least one subscription option
";

}

if ($pdfsets && ! $email) {

$ErrMsg .= "Please enter your email address
";

}

if ($ErrMsg) {

// We have some missing fields

print '

Please correct the following errors:

' . $ErrMsg . "

\n";

include "1.inc.php";

} Else {

if (! $ossub) { $ossub = 0; }
if (! $ossets) { $ossets = 0; }
if (! $msetsus) { $msetsus = 0; }
if (! $msetsca) { $msetsca = 0; }
if (! $pdfsets) { $pdfsets = 0; }

$st_ossub = sprintf("$ %6.2f", $ossub * 5.25);
$st_ossets = sprintf("$ %6.2f", $ossets * 6);
$st_msetsus = sprintf("$ %6.2f", $msetsus * 9);
$st_msetsca = sprintf("$ %6.2f", $msetsca * 12);
$st_pdfsets = sprintf("$ %6.2f", $pdfsets * 6);

$grandtotal = sprintf("$ %6.2f", ($ossub * 5.25) + ($ossets * 6) + ($msetsus * 9) + ($msetsca * 12) + ($pdfsets * 6));

print <<< END
















END;
if ($extraadress) {
print <<< END

END;
}
print <<< END

Please confirm your subscription information:
Modern Name: $name
SCA Name: $scaname:
Street Address: $address1
$address2
City: $city
State/Province: $state
Country: $country
Postal Code: $postalcode
Email Address: $email
Group Camping With: $group
 
Number of on-site subscriptions ($5.25): $ossub
Number of on-site sets ($6.00): $ossets
Number of PDF sets ($6.00): $pdfsets
Number of sets to be mailed (US, $9.00): $msetsus
Number of sets to mailed (Canada, $12.00): $msetsca
 
Additional Mailing Address
$extraaddress
 
Subtotal, on-site subscriptions: $st_ossub
Subtotal, on-site sets: $st_ossets
Subtotal, PDF sets: $st_pdfsets
Subtotal, mailed sets, US: $st_msetsus
Subtotal, mailed sets, Canada: $st_msetsca
 
Grand Total: $grandtotal

END;
}
} elseif ($finish) {

// build the sql statement

$sql = "insert into subscriptions values(NULL,'$name','$scaname','$address1','$address2','$city',";
$sql .= "'$state','$postalcode','$country','$email','$group',now(),$ossub,$ossets,$msetsus,$msetsca,";
$sql .= "'$pdfsets','$extraaddress',0,'no')";

// Database setup info. The user should have insert privs

$host = "localhost";
$dbname = "pennsicindependent_com";
$dbuser = "pi_com";
$dbpass = "6jcgGsP";

mysql_connect($host, $dbuser, $dbpass);

mysql_select_db($dbname);

$results = mysql_query($sql);

$userid = mysql_insert_id();

if (mysql_affected_rows() < 1) {

print "

There was a problem saving your subscription

\n";

} else {

print "

Your subscription has been saved. Click the button below to pay via paypal

\n

";

$grandtotal = sprintf("$%.2f", ($ossub * 5.25) + ($ossets * 6) + ($msetsus * 9) + ($msetsca * 12) + ($pdfsets * 6));
print <<< END











You can also mail a check to:


Pennsic Independent

2204 N 950 E

Lafayette, IN 47905


Checks should be payable to The Pennsic Independent and must arrive before July 30, 2004!

On-site subcribers, you MUST pick you your subscription card at the Pennsic Independent Office (near the barn) before you can recieve your paper. You will be able to get your paper either at the office, merchants who carry the paper or the ever present street urchins

END;

if ($pdfsets > 0) {

print <<< END

You MUST pay with Paypal for PDF sets. To download the PDF copies of each issue, go to
http://www.pennsicindependent.com/pdfs/
. The username and password will be emailed to you once payment is recieved.

DO NOT SHARE THIS PASSWORD WITH ANYONE!

END;
}

}

} else {
// THIS CAME FROM 1.inc.php
$wpi_provinces = array(
"AL" => "Alabama",
"AK" => "Alaska",
"AB" => "Alberta",
"AZ" => "Arizona",
"AR" => "Arkansas",
"BC" => "British Columbia",
"CA" => "California",
"CO" => "Colorado",
"CT" => "Connecticut",
"DE" => "Delaware",
"DC" => "District of Columbia",
"FL" => "Florida",
"GA" => "Georgia",
"GU" => "Guam",
"HI" => "Hawaii",
"ID" => "Idaho",
"IL" => "Illinois",
"IN" => "Indiana",
"IA" => "Iowa",
"KS" => "Kansas",
"KY" => "Kentucky",
"LA" => "Louisiana",
"ME" => "Maine",
"MB" => "Manitoba",
"MD" => "Maryland",
"MA" => "Massachusetts",
"MI" => "Michigan",
"MN" => "Minnesota",
"MS" => "Mississippi",
"MO" => "Missouri",
"MT" => "Montana",
"NE" => "Nebraska",
"NV" => "Nevada",
"NB" => "New Brunswick",
"NH" => "New Hampshire",
"NJ" => "New Jersey",
"NM" => "New Mexico",
"NY" => "New York",
"NF" => "Newfoundland",
"NC" => "North Carolina",
"ND" => "North Dakota",
"NT" => "Northwest Territories",
"NS" => "Nova Scotia",
"NT" => "Nunavut",
"OH" => "Ohio",
"OH" => "Ohio",
"OK" => "Oklahoma",
"ON" => "Ontario",
"OR" => "Oregon",
"PA" => "Pennsylvania",
"PE" => "Prince Edward Island",
"PR" => "Puerto Rico",
"QC" => "Quebec",
"RI" => "Rhode Island",
"SK" => "Saskatchewan",
"SC" => "South Carolina",
"SD" => "South Dakota",
"TN" => "Tennessee",
"TX" => "Texas",
"UT" => "Utah",
"VT" => "Vermont",
"VI" => "Virgin Islands (US)",
"VA" => "Virginia",
"WA" => "Washington",
"WV" => "West Virginia",
"WI" => "Wisconsin",
"WY" => "Wyoming",
"YT" => "Yukon Territory"
);

print <<

Modern Name (required)
SCA Name (required)
Street Address (required for mailed sets)
City (required for mailed sets)
State/Province (required for mailed sets) <Please make a selection>
END;
foreach($wpi_provinces as $abbrev => $province) {

print "

if ($state == $province) print " selected";

print ">$province\n";

} // foreach($provinces as $abbrev => $province)

print <<< END

Country (required for mailed sets) < Please Select >
END;

print ' if ($country == "USA") { print " selected"; }
print ">United States\n";
print ' if ($country == "CANADA") { print " selected";}
print ">Canada\n";
print <<< END

Postal Code (required for mailed sets)
Email Address (required for PDF sets)
Group Camping With (if applicible, required for on-site subscriptions or sets)
 
Number of on-site subscriptions ($5.25)
Number of on-site sets ($6.00)
Number of PDF sets ($6.00)
Number of sets to be mailed (US, $9.00)
Number of sets to mailed (Canada, $12.00)
 
Additional Mailing Address (if applicible)
$extraaddress
 

END;
// END 1.inc.php
}

Topics: