Jump to content

mermyphp

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by mermyphp

  1. Perhaps <meta content="30" http-equiv="refresh"/>? That will refresh every 30 seconds
  2. I am a complete newb when it comes to php :'(. I have a set of hit counters that moniter the amount of hits on certain webpages. The hits are stored in a log file. such as indexcount.txt or aboutuscount.txt. I was wondering if there is a way to reset all of the counters to 0 in a single button click using php. Any help would be appreciated. Thanks mermyphp
  3. You know how the world works... fix one thing break another. I got my order form to list errors all on one page, and then realized that it gave me the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/r/a/website/html/order/order.php:112) in /home/content/m/r/a/website/html/order/order.php on line 92 and here is my code: <?php /* Set e-mail recipient */ $myemail = "email@example.com"; /* Check all form inputs using check_input function */ $subject = check_input($_POST['subject'], "Please enter your name"); $email = check_input($_POST['email'], "Please enter your email"); $phone = check_input($_POST['phone']); $street = check_input($_POST['street'], "Please enter your street address"); $city = check_input($_POST['city'], "Please enter your city"); $state = check_input($_POST['state'], "Please enter your state/province"); $country = check_input($_POST['country'], "Please enter your country"); $postal = check_input($_POST['postal'], "Please enter your zip code"); $Manufacturer = check_input($_POST['Manufacturer'], "Please enter your boat manufacturer"); $Year = check_input($_POST['Year']); $BoatClass = check_input($_POST['BoatClass'], "Please choose your boat class"); $BoatModel = check_input($_POST['BoatModel'], "Please choose your boat model"); $CoverModel = check_input($_POST['CoverModel']); $CoverQuantity = check_input($_POST['CoverQuantity']); $CoverBoatModel = check_input($_POST['CoverBoatModel']); $RigQuantity = check_input($_POST['RigQuantity']); $Fabric = check_input($_POST['Fabric']); $OarBag = check_input($_POST['OarBag']); $MainColor = check_input($_POST['MainColorN']); $TipColor = check_input($_POST['TipColorN']); $MainColor = check_input($_POST['MainColorP']); $TipColor = check_input($_POST['TipColorP']); $MainColor = check_input($_POST['MainColorS']); $TipColor = check_input($_POST['TipColorS']); $requests = check_input($_POST['requests']); $how = check_input($_POST['how']); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $message = "example.com order form From: $subject $email $phone Shipping Address: $street $city, $state $country $postal Boat Type Manufacturer: $Manufacturer Year Built: $Year Boat Class: $BoatClass Boat Model: $BoatModel Quantity Product $CoverQuantity of $CoverModel $RigQuantity of Rigger Bag $OarQuantity of Oar Bag Fabric $Fabric Colors- Make sure colors corrospond to fabric choice. Ignore any other colors. Nylon Main Color: $MainColorN Nylon Tip Color: $TipColorN Polyester Main Color: $MainColorP Polyester Tip Color: $TipColorP Sunbrella Main Color: $MainColorS Sunbrella Tip Color: $TipColorS Special Requests $requests How They Found Us: $how "; /* Send the message using mail() function */ mail($myemail, $subject, $message, "From: $email"); /* LINE 92 is around here */ /* Redirect visitor to the thank you page LINE 92 */ header('Location: recieves.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <p> <?php echo $myError; ?> <a href="javascript:history.go(-1)">Go back</a><br /> </p> <?php } exit(); ?> I have a gut feeling this is just plain stupidity on my part, but if you could point out the mistake, I would be more than happy. Thank you
  4. Ugh.. Didn't make a difference
  5. I have an order form script, and when a user does not fill out a field, it shows an error message on a new page... one at a time. For example, if you forgot to fill in your email, and your name, it would show "please fill in your name Go Back". Then you fill in your name, and resubmit, it will say "please fill in your email Go Back", and so on. I would like to be able to list all the required fields at once when a user forgets to fill them in. Here is my current code: <?php /* Set e-mail recipient */ $myemail = "support@zip-cover.com"; /* Check all form inputs using check_input function */ $subject = check_input($_POST['subject'], "Please enter your name"); $email = check_input($_POST['email'], "Please enter your email"); $phone = check_input($_POST['phone']); $street = check_input($_POST['street'], "Please enter your street address"); $city = check_input($_POST['city'], "Please enter your city"); $state = check_input($_POST['state'], "Please enter your state/province"); $country = check_input($_POST['country'], "Please enter your country"); $postal = check_input($_POST['postal'], "Please enter your zip code"); $Manufacturer = check_input($_POST['Manufacturer'], "Please enter your boat manufacturer"); $Year = check_input($_POST['Year']); $BoatClass = check_input($_POST['BoatClass'], "Please choose your boat class"); $BoatModel = check_input($_POST['BoatModel'], "Please choose your boat model"); $CoverModel = check_input($_POST['CoverModel']); $CoverQuantity = check_input($_POST['CoverQuantity']); $CoverBoatModel = check_input($_POST['CoverBoatModel']); $RigQuantity = check_input($_POST['RigQuantity']); $Fabric = check_input($_POST['Fabric']); $OarBag = check_input($_POST['OarBag']); $MainColor = check_input($_POST['MainColorN']); $TipColor = check_input($_POST['TipColorN']); $MainColor = check_input($_POST['MainColorP']); $TipColor = check_input($_POST['TipColorP']); $MainColor = check_input($_POST['MainColorS']); $TipColor = check_input($_POST['TipColorS']); $requests = check_input($_POST['requests']); $how = check_input($_POST['how']); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $message = "Zip-Cover.com order form From: $subject $email $phone Shipping Address: $street $city, $state $country $postal Boat Type Manufacturer: $Manufacturer Year Built: $Year Boat Class: $BoatClass Boat Model: $BoatModel Quantity Product $CoverQuantity of $CoverModel $RigQuantity of Rigger Bag $OarQuantity of Oar Bag Fabric $Fabric Colors- Make sure colors corrospond to fabric choice. Ignore any other colors. Nylon Main Color: $MainColorN Nylon Tip Color: $TipColorN Polyester Main Color: $MainColorP Polyester Tip Color: $TipColorP Sunbrella Main Color: $MainColorS Sunbrella Tip Color: $TipColorS Special Requests $requests How They Found Us: $how zip-cover.com "; /* Send the message using mail() function */ mail($myemail, $subject, $message, "From: $email"); /* Redirect visitor to the thank you page */ header('Location: recieves.html'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <b>Fields with red astericks are required. <br />Please correct the following error:</b><br /> <?php echo $myError; ?><br /> <a href="javascript:history.go(-1)">Go back</a> </body> </html> <?php exit(); } ?> Any help would be appreciated greatly. Thanks in advance, mermyphp
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.