"; print mysql_connect_error(); print "
"; } ?>
seal
350th Anniversary Merchandise

Welcome to Huntington Town Hall's online store for merchandise and memorabilia related to its 350th Anniversary!!!


$error"; } print "
\n

"; print "Name:

\n"; print "Address:

\n"; print "City:

\n"; print "State:

\n"; print "Zip Code:

\n"; print "Email:

\n"; print "Phone Number:

\n"; print "

\n"; mysql_select_db('mcats'); $query="SELECT * FROM products"; $result=mysql_query($query) ; /* query sent */ $error=mysql_error(); if($error) { print "error: $error!
"; } print ""; while($row=mysql_fetch_array($result)) { print ""; print ""; print ""; print ""; } print "
"; print "\"\"\n"; print ""; print $name=$row[name]; $max=get_stock($name); print choose_to_number($max+1,$row[name]); print ""; print "$row[description]"; print ""; print "$row[stock]"; print ""; print "$row[availability]"; print "
\n"; print "

\n"; print "\n"; print "

please submit order only once!!\n"; print "

\n"; print "
\n"; } function choose_to_number($max,$name) { $count=0; $out="\n"; return $out; } function set_stock($name,$new_stock) { $query="UPDATE products SET stock='$new_stock' WHERE name='$name'"; mysql_query($query); /* query sent */ $error=mysql_error(); if($error) { print "error: $error!
"; } } function get_stock($name) { $query="SELECT stock FROM products WHERE name='$name'"; mysql_select_db('mcats'); $result=mysql_query($query); /* query sent */ $error=mysql_error(); if($error) { print "error: $error!
"; } $row=mysql_fetch_array($result); $stock=$row[stock]; return $stock; } function compose_message () { foreach($_GET as $product => $number_ordered) { $out.="$number_ordered of $product was ordered\n"; } $old_number=get_stock($product); $new_number=$old_number-$number_ordered; set_stock($product,$new_number); return $out; } function send_mail() { $from=$from.' '; $name=$_GET['name']; $address=$_GET['address']; $city=$_GET['city']; $state=$_GET['state']; $zip=$_GET['zip']; $email=$_GET['email']; $phone=$_GET['phone']; $subject="A new order has been submitted\n"; $text=compose_message(); mail('',$subject,$text); } function deal_with_form() { $name=$_GET['name']; $address=$_GET['address']; $city=$_GET['city']; $state=$_GET['state']; $zip=$_GET['zip']; $email=$_GET['email']; $phone=$_GET['phone']; if(! $name) { $error="You did not enter a valid name.
\n"; } if(! $address) { $error=$error." You did not enter a valid address.
\n"; } if(! $city) { $error=$error." You did not enter a valid city name.
\n"; } if(! $state) { $error=$error." You did not enter a valid state name.
\n"; } if(! $zip) { $error=$error." You did not enter a valid zip code.
\n"; } if(! $email) { $error=$error." You did not enter a valid email address.
\n"; } if(! $phone) { $error=$error." You did not enter a valid phone number.
\n"; } if($error) { make_form($error); } else { print "

Thank you. Your request has been received.

"; print "\n"; print "

submitted ". date('jS F Y') . " at ". date('H:i'). "

\n"; send_mail(); } } ?>
Mission Statement The Archives Reaches Out Meet The Archives Staff The Huntington Memorial Publications

Valid XHTML 1.0!