Solved

Adding Mail function to form

Posted on 2008-10-09
17
284 Views
Last Modified: 2010-04-21
I need help incorporating a mail function to my form
I have added the Name, Email, and Site fields which need to be required.
I also have a drop down menu that needs to CC the email to the person they choose.

URGENT PLEASE HELP
<?php
if( !empty($_POST['action']) )
{
	header("Content-type: text/plain");
	$submittedData="";
	foreach($_POST['StandardSupplies'] as $value)
	{
		$k=$value."_quantity";
		if(!empty($_POST[$k]))
			$submittedData .= "\n".str_replace("_"," ",$value) . ": " . $_POST[$k];
	}
	$submittedData .="\nNo Worries Campaign";
	$submittedData .="\n\tQuantity: " . $_POST['NWC_quantity'];
	$nwc=array('Flyers','Posters','Banners','Post_Cards');
	foreach($nwc as $chk)
	{
		if( !empty($_POST[$chk]) )
		{
			$submittedData .= "\n\t" . $chk.":";
			foreach($_POST[$chk] as $value)
			{
				$submittedData .= "\n\t\t".str_replace("_"," ",$value);
			}
		}
	}
	if(!empty($submittedData))
	{
		mail("natalie.teinert@clvusa.com","Order details",$submittedData);
		echo "\n\nThank you!";
	}
	exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.row1{float:left;width:25%;}
.row2{float:left;width:20%;}
.col1{float:left;width:49%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
-->
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="orderform_thanks.php">
  <label><strong>Name:</strong></label>
  <input name="Name" type="text" id="Name" size="27">
  <br><br>
  <label><strong>Email:</strong></label>
  <input name="Email" type="text" id="Email" size="27">
  <br><br>
<label><strong>Site:</strong></label>
<input name="Site" type="text" id="Site" size="29">
<br>
<br>
<label>Regional Manager
<select name="regional_manager" id="regional_manager">
  <option selected>-</option>
  <option>Person A</option>
  <option>Person B</option>
  <option>Person C</option>
  <option>Person D</option>
  <option>Person E</option>
  <option>Person F</option>
</select>
</label>
<br>
<br>
  <fieldset><legend>Standard Supplies</legend>
		<div class="row1"><input type="checkbox" name="StandardSupplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
	      <option value="2500">2500</option>
	      <option value="3000">3000</option>
	      <option value="3500">3500</option>
	      <option value="4000">4000</option>
	      <option value="4500">4500</option>
	      <option value="5000">5000</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="StandardSupplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0" selected>-</option>
		    <option value="1 - 6 ft.">1 - 6 ft.</option>
		    <option value="2 - 6 ft.">2 - 6 ft.</option>
		    <option value="3 - 6 ft.">3 - 6 ft.</option>
		    <option value="1 - 8 ft.">1 - 8 ft.</option>
		    <option value="2 - 8 ft.">2 - 8 ft.</option>
		    <option value="3 - 8 ft.">3 - 8 ft.</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="StandardSupplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		    <option value="3">3</option>
		</select></div>
  <div><input type="checkbox" name="StandardSupplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Flyers</legend>
		<div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="ClassFlyer" />Class In Ten Minutes? <select name="ClassFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="ApartmentFlyer" />Apartment Hunting? <select name="ApartmentFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="RoommateFlyer" />Roommate Hasn't Paid Up? <select name="RoommateFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
  <div><input type="checkbox" name="NoWorriesFlyers[]" value="RentsFlyer" />'Rents Cramping Your Style? <select name="RentsFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Posters</legend>
		<div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="ClassPoster" />Class In Ten Minutes? <select name="ClassPoster_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		    <option value="3">3</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="ApartmentPoster" />Apartment Hunting? <select name="ApartmentPoster_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		    <option value="3">3</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="RoommatePoster" />Roommate Hasn't Paid Up? <select name="RoommatePoster_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		    <option value="3">3</option>
		</select></div>
  <div><input type="checkbox" name="NoWorriesPosters[]" value="RentsPoster" />'Rents Cramping Your Style? <select name="RentsPoster_quantity"><option value="0" selected>-</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Banners</legend>
		<div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="ClassBanner" />Class In Ten Minutes? <select name="ClassBanner_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="ApartmentBanner" />Apartment Hunting? <select name="ApartmentBanner_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		</select></div>
		<div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="RoommateBanner" />Roommate Hasn't Paid Up? <select name="RoommateBanner_quantity"><option value="0" selected>-</option>
		    <option value="1">1</option>
		    <option value="2">2</option>
		</select></div>
  <div><input type="checkbox" name="NoWorriesBanners[]" value="RentsBanner" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" selected>-</option>
      <option value="1">1</option>
      <option value="2">2</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Postcards</legend>
		<div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="ClassPostcard" />Class In Ten Minutes? <select name="ClassPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
		<div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="ApartmentPostcard" />Apartment Hunting? <select name="ApartmentPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
		<div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="RoommatePostcard" />Roommate Hasn't Paid Up? <select name="RoommatePostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
		    <option value="2500">2500</option>
		    <option value="3000">3000</option>
		    <option value="3500">3500</option>
		    <option value="4000">4000</option>
		    <option value="4500">4500</option>
		    <option value="5000">5000</option>
		</select></div>
  <div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="RentsPostcard" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  <div><input type="checkbox" name="NoWorriesPostcards[]" value="ForeignPostcard" />Foreign City?<select name="ForeignPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
<br>
<input type="submit" name="Submit" id="Submit" value="Submit">
</label>
</form>
</body>
</html>

Open in new window

0
Comment
Question by:natsully
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
  • 3
  • +1
17 Comments
 

Author Comment

by:natsully
ID: 22678548
*Not how to add mail function, sorry, its there.
But how to incorporate receiving the name, email, and site info as well as mailing the Regional Manager they choose
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 22678677
You need to store the email addresses of the reginal managers somewhere. In the example below they are hardcoded in an array, if possible you should pull this from a database.

There is an optional fourth parameter to the PHP mail() function. This can be used for additional headers, including a CC header.

http://php.net/manual/en/function.mail.php

Something like this:
if(!empty($submittedData)) {
  $manager_emails = array(
    'Person A' => 'a@company.com',
    'Person B' => 'b@company.com',
    'Person C' => 'c@company.com',
    'Person D' => 'd@company.com',
    'Person E' => 'e@company.com',
    'Person F' => 'f@company.com'
  );
  $manager = $_POST['regional_manager'];
  $cc = isset($manager_emails[$manager]) ? $manager_emails[$manager] : '';
  $result = @mail("your.email@company.com","Order details",
       $submittedData,
       $cc?"Cc: $manager <$cc>":null);
  echo "\n\n".($result?
    "Thank you!":
    "Error sending email");
}

Open in new window

0
 
LVL 3

Expert Comment

by:Mr_Splash
ID: 22678751
I've have made alterations to you code below.

I have added comments where you should add the managers email addresses.
<?php
if( !empty($_POST['action']) )
{
        header("Content-type: text/plain");
				$name = htmlentities($_POST['Name']);]
				$email = htmlentities($_POST['Email']);
				$site = htmlentities($_POST['Site']);
				$rManager = htmlentities($_POST['regional_manager']);
				
				//////// Add Manager Emails in here /////////
				//Repeat rows if more managers added
				
				if ($rManager == 'Person A') {    $mEmail = 'email@email.com';   }
				if ($rManager == 'Person B') {    $mEmail = 'email@email.com';   }
				if ($rManager == 'Person C') {    $mEmail = 'email@email.com';   }
				if ($rManager == 'Person D') {    $mEmail = 'email@email.com';   }
				if ($rManager == 'Person E') {    $mEmail = 'email@email.com';   }
				if ($rManager == 'Person f') {    $mEmail = 'email@email.com';   }
				
				/////////////////////////////////////////////
				
        $submittedData="Name = $name\nEmail = $email\n Site = $site\n\n";
        foreach($_POST['StandardSupplies'] as $value)
        {
                $k=$value."_quantity";
                if(!empty($_POST[$k]))
                        $submittedData .= "\n".str_replace("_"," ",$value) . ": " . $_POST[$k];
        }
        $submittedData .="\nNo Worries Campaign";
        $submittedData .="\n\tQuantity: " . $_POST['NWC_quantity'];
        $nwc=array('Flyers','Posters','Banners','Post_Cards');
        foreach($nwc as $chk)
        {
                if( !empty($_POST[$chk]) )
                {
                        $submittedData .= "\n\t" . $chk.":";
                        foreach($_POST[$chk] as $value)
                        {
                                $submittedData .= "\n\t\t".str_replace("_"," ",$value);
                        }
                }
        }
        if(!empty($submittedData))
        {
                mail("natalie.teinert@clvusa.com","Order details",$submittedData, "Cc: $mEmail");
                echo "\n\nThank you!";
        }
        exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.row1{float:left;width:25%;}
.row2{float:left;width:20%;}
.col1{float:left;width:49%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
-->
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="orderform_thanks.php">
  <label><strong>Name:</strong></label>
  <input name="Name" type="text" id="Name" size="27">
  <br><br>
  <label><strong>Email:</strong></label>
  <input name="Email" type="text" id="Email" size="27">
  <br><br>
<label><strong>Site:</strong></label>
<input name="Site" type="text" id="Site" size="29">
<br>
<br>
<label>Regional Manager
<select name="regional_manager" id="regional_manager">
  <option selected>-</option>
  <option>Person A</option>
  <option>Person B</option>
  <option>Person C</option>
  <option>Person D</option>
  <option>Person E</option>
  <option>Person F</option>
</select>
</label>
<br>
<br>
  <fieldset><legend>Standard Supplies</legend>
                <div class="row1"><input type="checkbox" name="StandardSupplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
              <option value="2500">2500</option>
              <option value="3000">3000</option>
              <option value="3500">3500</option>
              <option value="4000">4000</option>
              <option value="4500">4500</option>
              <option value="5000">5000</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="StandardSupplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0" selected>-</option>
                    <option value="1 - 6 ft.">1 - 6 ft.</option>
                    <option value="2 - 6 ft.">2 - 6 ft.</option>
                    <option value="3 - 6 ft.">3 - 6 ft.</option>
                    <option value="1 - 8 ft.">1 - 8 ft.</option>
                    <option value="2 - 8 ft.">2 - 8 ft.</option>
                    <option value="3 - 8 ft.">3 - 8 ft.</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="StandardSupplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select></div>
  <div><input type="checkbox" name="StandardSupplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Flyers</legend>
                <div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="ClassFlyer" />Class In Ten Minutes? <select name="ClassFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="ApartmentFlyer" />Apartment Hunting? <select name="ApartmentFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesFlyers[]" value="RoommateFlyer" />Roommate Hasn't Paid Up? <select name="RoommateFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
  <div><input type="checkbox" name="NoWorriesFlyers[]" value="RentsFlyer" />'Rents Cramping Your Style? <select name="RentsFlyer_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Posters</legend>
                <div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="ClassPoster" />Class In Ten Minutes? <select name="ClassPoster_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="ApartmentPoster" />Apartment Hunting? <select name="ApartmentPoster_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesPosters[]" value="RoommatePoster" />Roommate Hasn't Paid Up? <select name="RoommatePoster_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select></div>
  <div><input type="checkbox" name="NoWorriesPosters[]" value="RentsPoster" />'Rents Cramping Your Style? <select name="RentsPoster_quantity"><option value="0" selected>-</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Banners</legend>
                <div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="ClassBanner" />Class In Ten Minutes? <select name="ClassBanner_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="ApartmentBanner" />Apartment Hunting? <select name="ApartmentBanner_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                </select></div>
                <div class="row1"><input type="checkbox" name="NoWorriesBanners[]" value="RoommateBanner" />Roommate Hasn't Paid Up? <select name="RoommateBanner_quantity"><option value="0" selected>-</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                </select></div>
  <div><input type="checkbox" name="NoWorriesBanners[]" value="RentsBanner" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" selected>-</option>
      <option value="1">1</option>
      <option value="2">2</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Postcards</legend>
                <div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="ClassPostcard" />Class In Ten Minutes? <select name="ClassPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
                <div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="ApartmentPostcard" />Apartment Hunting? <select name="ApartmentPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
                <div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="RoommatePostcard" />Roommate Hasn't Paid Up? <select name="RoommatePostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                    <option value="2500">2500</option>
                    <option value="3000">3000</option>
                    <option value="3500">3500</option>
                    <option value="4000">4000</option>
                    <option value="4500">4500</option>
                    <option value="5000">5000</option>
                </select></div>
  <div class="row2"><input type="checkbox" name="NoWorriesPostcards[]" value="RentsPostcard" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  <div><input type="checkbox" name="NoWorriesPostcards[]" value="ForeignPostcard" />Foreign City?<select name="ForeignPostcard_quantity"><option value="0" selected>-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
<br>
<input type="submit" name="Submit" id="Submit" value="Submit">
</label>
</form>
</body>
</html>

Open in new window

0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

Author Comment

by:natsully
ID: 22678960
cxr,
I know it would make things easier to pull from a database but I have absolutely no experience with them.

Mr_Splash,
can't seem to get it to work.

0
 
LVL 3

Expert Comment

by:Mr_Splash
ID: 22679033
Are you getting an error message at tall?
0
 
LVL 82

Expert Comment

by:hielo
ID: 22679087
supply your email address and try:
<?php
if( !empty($_POST['Name']) && !empty($_POST['Email']) && !empty($_POST['Site']) )
{
	header("Content-type: text/plain"); 
      $submittedData="";
	 
      $submittedData.="\nName:" . $_POST['Name'];
      $submittedData.="\nEmail:" . $_POST['Email'];
      $submittedData.="\nSite:" . $_POST['Site'];
      $submittedData.="\nRegional Manager:" . $_POST['regional_manager'];
	 
	 $fields=array('Standard_Supplies','No_Worries_Flyers','No_Worries_Posters','No_Worries_Banners','No_Worries_Postcards');
	foreach($fields as $arrName)
	{
		 if(isset($_POST[$arrName]))
		 {
			 $submittedData.="\n\n" . str_replace("_"," ",$arrName);
		      foreach($_POST['Standard_Supplies'] as $value)
		      {
		            $k=$value."_quantity";
		            if(!empty($_POST[$k]))
		                  $submittedData .= "\n\t".str_replace("_"," ",$value) . ": " . $_POST[$k];
		      }
		 }
	}
	 $headers="CC:".$_POST['Email'];
      if(!empty($submittedData))
      {
            mail("natalie.teinert@COMPANY.com","Order details",$submittedData,$headers);
		// echo $submittedData;
            echo "\n\nThank you!";
      }
      exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
.row1{float:left;width:24%;}
.row2{float:left;width:20%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
  <label><strong>* Name:</strong></label>
  <input name="Name" type="text" id="Name" size="27">
  <br><br>
  <label><strong>* Email:</strong></label>
  <input name="Email" type="text" id="Email" size="27">
  <br><br>
<label><strong>* Site:</strong></label>
<input name="Site" type="text" id="Site" size="29">
<br>
<br>
<label>Regional Manager
<select name="regional_manager" id="regional_manager">
  <option >-</option>
  <option>Person A</option>
  <option>Person B</option>
  <option>Person C</option>
  <option>Person D</option>
  <option>Person E</option>
  <option>Person F</option>
</select>
</label>
<br>
<br>
  <fieldset><legend>Standard Supplies</legend> 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0"  >-</option>
		  <option value="500">500</option>
		  <option value="1000">1000</option>
		  <option value="1500">1500</option>
		  <option value="2000">2000</option>
            <option value="2500">2500</option>
            <option value="3000">3000</option>
            <option value="3500">3500</option>
            <option value="4000">4000</option>
            <option value="4500">4500</option>
            <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0"  >-</option>
                <option value="1 - 6 ft.">1 - 6 ft.</option>
                <option value="2 - 6 ft.">2 - 6 ft.</option>
                <option value="3 - 6 ft.">3 - 6 ft.</option>
                <option value="1 - 8 ft.">1 - 8 ft.</option>
                <option value="2 - 8 ft.">2 - 8 ft.</option>
                <option value="3 - 8 ft.">3 - 8 ft.</option>
            </select></div> 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0" >-</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Flyers</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ClassFlyer" />Class In Ten Minutes? <select name="ClassFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ApartmentFlyer" />Apartment Hunting? <select name="ApartmentFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RoommateFlyer" />Roommate Hasn't Paid Up? <select name="RoommateFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RentsFlyer" />'Rents Cramping Your Style? <select name="RentsFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Posters</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ClassPoster" />Class In Ten Minutes? <select name="ClassPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ApartmentPoster" />Apartment Hunting? <select name="ApartmentPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RoommatePoster" />Roommate Hasn't Paid Up? <select name="RoommatePoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RentsPoster" />'Rents Cramping Your Style? <select name="RentsPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Banners</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ClassBanner" />Class In Ten Minutes? <select name="ClassBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ApartmentBanner" />Apartment Hunting? <select name="ApartmentBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RoommateBanner" />Roommate Hasn't Paid Up? <select name="RoommateBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RentsBanner" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Postcards</legend>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ClassPostcard" />Class In Ten Minutes? <select name="ClassPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ApartmentPostcard" />Apartment Hunting? <select name="ApartmentPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RoommatePostcard" />Roommate Hasn't Paid Up? <select name="RoommatePostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RentsPostcard" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ForeignPostcard" />Foreign City?<select name="ForeignPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
<br>
<input type="submit" name="Submit" id="Submit" value="Submit"> 
</form>
</body>
</html> 

<?php
exit; 
if( !empty($_POST['action']) )
{
	header("Content-type: text/plain");
	$submittedData="";
	foreach($_POST['Standard_Supplies'] as $value)
	{
		$k=$value."_quantity";
		if(!empty($_POST[$k]))
			$submittedData .= "\n".str_replace("_"," ",$value) . ": " . $_POST[$k];
	}
	$submittedData .="\nNo Worries Campaign";
	$submittedData .="\n\tQuantity: " . $_POST['NWC_quantity'];
	$nwc=array('Flyers','Posters','Banners','Post_Cards');
	foreach($nwc as $chk)
	{
		if( !empty($_POST[$chk]) )
		{
			$submittedData .= "\n\t" . $chk.":";
			foreach($_POST[$chk] as $value)
			{
				$submittedData .= "\n\t\t".str_replace("_"," ",$value);
			}
		}
	}
	if(!empty($submittedData))
	{
		//mail("you@yourcompany.com","Order details",$submittedData);
		echo $submittedData;
		echo "\n\nThank you!";
	}
	exit;
}
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.row1{float:left;width:25%;}
.col1{float:left;width:49%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
-->
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
	<fieldset><legend>Standard Supplies</legend>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
	</fieldset>
 
	<fieldset><legend>No Worries Campaign</legend>
		<div>Quantity: <input type="text" name="NWC_quantity"/></div>
		<fieldset><legend>Flyers</legend>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Flyers[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Flyers[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Posters</legend>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Posters[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Posters[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Banners</legend>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Banners[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Banners[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Post Cards</legend>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
	</fieldset>
	<div><input type="submit" name="action" value="Submit"/></div>
</form>
</body>
</html>

Open in new window

0
 

Author Comment

by:natsully
ID: 22679184
hielo,
Thats much better.
What I meant with the CC though is to not have it CCed to the user but CCed to either Person A, Person B, etc. or whoever they choose
0
 

Author Comment

by:natsully
ID: 22679262
and I just noticed, when the email comes through it repeats every value selected in the "StandardSuplies section when other products are selected.

ex. "Standard Supplies
      RateSheet: 500
      Table Drape: 1 - 6 ft.

No Worries Flyers
      RateSheet: 500
      Table Drape: 1 - 6 ft.

No Worries Posters
      RateSheet: 500
      Table Drape: 1 - 6 ft."
0
 

Author Comment

by:natsully
ID: 22679272
points are no issue, I'll post as many questions as you need I just need this completed quickly.
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 22679425
Change this:

foreach($_POST['Standard_Supplies'] as $value)

... to this:

foreach($_POST[$arrName] as $value)
0
 

Author Comment

by:natsully
ID: 22679506
that gives a "Warning:  Invalid argument supplied for foreach() in 'my server address' on line 18"
(the line you supplied above) and doesn't pass the variables through on the email
0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 22679626
>>What I meant with the CC though is to not have it CCed to the user but CCed to either Person A, Person B, etc. or whoever they choose
Ok, but you will need  a list of those emails:
<?php
if( !empty($_POST['Name']) && !empty($_POST['Email']) && !empty($_POST['Site']) )
{
	header("Content-type: text/plain");
 
	$RegionalManager=array();
	$RegionalManager['A']="PersonA@company.com";
	$RegionalManager['B']="PersonB@company.com";
	$RegionalManager['C']="PersonC@company.com";
	$RegionalManager['D']="PersonD@company.com";
	$RegionalManager['E']="PersonE@company.com";
	$RegionalManager['F']="PersonF@company.com";
 
	
      $submittedData="";
	 
      $submittedData.="\nName:" . $_POST['Name'];
      $submittedData.="\nEmail:" . $_POST['Email'];
      $submittedData.="\nSite:" . $_POST['Site'];
      $submittedData.="\nRegional Manager:" . $_POST['regional_manager'];
	 
	 $fields=array('Standard_Supplies','No_Worries_Flyers','No_Worries_Posters','No_Worries_Banners','No_Worries_Postcards');
	foreach($fields as $arrName)
	{
		 if(isset($_POST[$arrName]))
		 {
			 $submittedData.="\n\n" . str_replace("_"," ",$arrName);
		      foreach($_POST['Standard_Supplies'] as $value)
		      {
		            $k=$value."_quantity";
		            if(!empty($_POST[$k]))
		                  $submittedData .= "\n\t".str_replace("_"," ",$value) . ": " . $_POST[$k];
		      }
		 }
	}
	 $headers="CC:". $RegionalManager[ $_POST['regional_manager'] ];
      if(!empty($submittedData))
      {
            mail("natalie.teinert@company.com","Order details",$submittedData,$headers);
		 //echo $submittedData;
            echo "\n\nThank you!";
      }
      exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
.row1{float:left;width:24%;}
.row2{float:left;width:20%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
  <label><strong>* Name:</strong></label>
  <input name="Name" type="text" id="Name" size="27">
  <br><br>
  <label><strong>* Email:</strong></label>
  <input name="Email" type="text" id="Email" size="27">
  <br><br>
<label><strong>* Site:</strong></label>
<input name="Site" type="text" id="Site" size="29">
<br>
<br>
<label>Regional Manager
<select name="regional_manager" id="regional_manager">
  <option  value="">-</option>
  <option value="A">Person A</option>
  <option value="B">Person B</option>
  <option value="C">Person C</option>
  <option value="D">Person D</option>
  <option value="E">Person E</option>
  <option value="F">Person F</option>
</select>
</label>
<br>
<br>
  <fieldset><legend>Standard Supplies</legend>
 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0"  >-</option>
		  <option value="500">500</option>
		  <option value="1000">1000</option>
		  <option value="1500">1500</option>
		  <option value="2000">2000</option>
            <option value="2500">2500</option>
            <option value="3000">3000</option>
            <option value="3500">3500</option>
            <option value="4000">4000</option>
            <option value="4500">4500</option>
            <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0"  >-</option>
                <option value="1 - 6 ft.">1 - 6 ft.</option>
                <option value="2 - 6 ft.">2 - 6 ft.</option>
                <option value="3 - 6 ft.">3 - 6 ft.</option>
                <option value="1 - 8 ft.">1 - 8 ft.</option>
                <option value="2 - 8 ft.">2 - 8 ft.</option>
                <option value="3 - 8 ft.">3 - 8 ft.</option>
            </select></div>
 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0" >-</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Flyers</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ClassFlyer" />Class In Ten Minutes? <select name="ClassFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ApartmentFlyer" />Apartment Hunting? <select name="ApartmentFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RoommateFlyer" />Roommate Hasn't Paid Up? <select name="RoommateFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RentsFlyer" />'Rents Cramping Your Style? <select name="RentsFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Posters</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ClassPoster" />Class In Ten Minutes? <select name="ClassPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ApartmentPoster" />Apartment Hunting? <select name="ApartmentPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RoommatePoster" />Roommate Hasn't Paid Up? <select name="RoommatePoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RentsPoster" />'Rents Cramping Your Style? <select name="RentsPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Banners</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ClassBanner" />Class In Ten Minutes? <select name="ClassBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ApartmentBanner" />Apartment Hunting? <select name="ApartmentBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RoommateBanner" />Roommate Hasn't Paid Up? <select name="RoommateBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RentsBanner" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Postcards</legend>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ClassPostcard" />Class In Ten Minutes? <select name="ClassPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ApartmentPostcard" />Apartment Hunting? <select name="ApartmentPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RoommatePostcard" />Roommate Hasn't Paid Up? <select name="RoommatePostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RentsPostcard" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ForeignPostcard" />Foreign City?<select name="ForeignPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
<br>
<input type="submit" name="Submit" id="Submit" value="Submit">
 
</form>
</body>
</html>
 
 
<?php
exit;
 
if( !empty($_POST['action']) )
{
	header("Content-type: text/plain");
	$submittedData="";
	foreach($_POST['Standard_Supplies'] as $value)
	{
		$k=$value."_quantity";
		if(!empty($_POST[$k]))
			$submittedData .= "\n".str_replace("_"," ",$value) . ": " . $_POST[$k];
	}
	$submittedData .="\nNo Worries Campaign";
	$submittedData .="\n\tQuantity: " . $_POST['NWC_quantity'];
	$nwc=array('Flyers','Posters','Banners','Post_Cards');
	foreach($nwc as $chk)
	{
		if( !empty($_POST[$chk]) )
		{
			$submittedData .= "\n\t" . $chk.":";
			foreach($_POST[$chk] as $value)
			{
				$submittedData .= "\n\t\t".str_replace("_"," ",$value);
			}
		}
	}
	if(!empty($submittedData))
	{
		//mail("you@yourcompany.com","Order details",$submittedData);
		echo $submittedData;
		echo "\n\nThank you!";
	}
	exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.row1{float:left;width:25%;}
.col1{float:left;width:49%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
-->
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
	<fieldset><legend>Standard Supplies</legend>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
	</fieldset>
 
	<fieldset><legend>No Worries Campaign</legend>
		<div>Quantity: <input type="text" name="NWC_quantity"/></div>
		<fieldset><legend>Flyers</legend>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Flyers[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Flyers[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Posters</legend>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Posters[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Posters[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Banners</legend>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Banners[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Banners[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Post Cards</legend>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
	</fieldset>
	<div><input type="submit" name="action" value="Submit"/></div>
</form>
</body>
</html>

Open in new window

0
 

Author Comment

by:natsully
ID: 22679718
hielo, that did the trick.

I've posted the rest of my question in a new question for more points.
You can view it here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23801381.html

PLEASE HELP!
0
 

Author Closing Comment

by:natsully
ID: 31504648
Thanks so much!!
You're really helping me out!
Please help me finish it out!!
Thanks!!
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 22679742
>> "Warning:  Invalid argument supplied for foreach() in 'my server address' on line 18"

Try changing the same line into this:

if(is_array($_POST[$arrName]) foreach($_POST[$arrName] as $value)

hielo: what is going on after </html> (line  279) in your suggestion? The 'exit' in line 283 kills the PHP, but the extra markup (lines 319-379) is sent to the browser...?
0
 
LVL 39

Expert Comment

by:Roger Baklund
ID: 22679760
sorry, missing a closing parenthesis for the if():

if(is_array($_POST[$arrName])) foreach($_POST[$arrName] as $value)
0
 
LVL 82

Expert Comment

by:hielo
ID: 22679765
try this:
<?php
if( !empty($_POST['Name']) && !empty($_POST['Email']) && !empty($_POST['Site']) )
{
	header("Content-type: text/plain");
 
	//if you set this to false you will get "No Worries Posters". 
	//When true, you just get "Posters"
	$RemoveNoWorriesPrefix=true;
 
	//list or regional managers to be cc
	$RegionalManager=array();
	$RegionalManager['A']="PersonA@company.com";
	$RegionalManager['B']="PersonB@company.com";
	$RegionalManager['C']="PersonC@company.com";
	$RegionalManager['D']="PersonD@company.com";
	$RegionalManager['E']="PersonE@company.com";
	$RegionalManager['F']="PersonF@company.com";
 
	
      $submittedData="";
	 
      $submittedData.="\nName:" . $_POST['Name'];
      $submittedData.="\nEmail:" . $_POST['Email'];
      $submittedData.="\nSite:" . $_POST['Site'];
      $submittedData.="\nRegional Manager:" . $_POST['regional_manager'];
	 
	 $fields=array('Standard_Supplies','No_Worries_Flyers','No_Worries_Posters','No_Worries_Banners','No_Worries_Postcards');
	foreach($fields as $arrName)
	{
		 if(isset($_POST[$arrName]))
		 {
		 	if($RemoveNoWorriesPrefix)
				$submittedData.="\n\n" . str_replace("No Worries ","",str_replace("_"," ",$arrName));
			else
				$submittedData.="\n\n" . str_replace("_"," ",$arrName);
 
		      foreach($_POST[$arrName] as $value)
		      {
		            $k=$value."_quantity";
		            if(!empty($_POST[$k]))
		                  $submittedData .= "\n\t".str_replace("_"," ",$value) . ": " . $_POST[$k];
		      }
		 }
	}
	 $headers="";
	 if(!empty($_POST['regional_manager']))
	 	$headers="CC:". $RegionalManager[ $_POST['regional_manager'] ];
      if(!empty($submittedData))
      {
            mail("natalie.teinert@company.com","Order details",$submittedData,$headers);
		 //echo $submittedData;
            echo "\n\nThank you!";
      }
      exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
.row1{float:left;width:24%;}
.row2{float:left;width:20%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
  <label><strong>* Name:</strong></label>
  <input name="Name" type="text" id="Name" size="27">
  <br><br>
  <label><strong>* Email:</strong></label>
  <input name="Email" type="text" id="Email" size="27">
  <br><br>
<label><strong>* Site:</strong></label>
<input name="Site" type="text" id="Site" size="29">
<br>
<br>
<label>Regional Manager
<select name="regional_manager" id="regional_manager">
  <option  value="">-</option>
  <option value="A">Person A</option>
  <option value="B">Person B</option>
  <option value="C">Person C</option>
  <option value="D">Person D</option>
  <option value="E">Person E</option>
  <option value="F">Person F</option>
</select>
</label>
<br>
<br>
  <fieldset><legend>Standard Supplies</legend>
 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0"  >-</option>
		  <option value="500">500</option>
		  <option value="1000">1000</option>
		  <option value="1500">1500</option>
		  <option value="2000">2000</option>
            <option value="2500">2500</option>
            <option value="3000">3000</option>
            <option value="3500">3500</option>
            <option value="4000">4000</option>
            <option value="4500">4500</option>
            <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0"  >-</option>
                <option value="1 - 6 ft.">1 - 6 ft.</option>
                <option value="2 - 6 ft.">2 - 6 ft.</option>
                <option value="3 - 6 ft.">3 - 6 ft.</option>
                <option value="1 - 8 ft.">1 - 8 ft.</option>
                <option value="2 - 8 ft.">2 - 8 ft.</option>
                <option value="3 - 8 ft.">3 - 8 ft.</option>
            </select></div>
 
            <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0" >-</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Flyers</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ClassFlyer" />Class In Ten Minutes? <select name="ClassFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="ApartmentFlyer" />Apartment Hunting? <select name="ApartmentFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RoommateFlyer" />Roommate Hasn't Paid Up? <select name="RoommateFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Flyers[]" value="RentsFlyer" />'Rents Cramping Your Style? <select name="RentsFlyer_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Posters</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ClassPoster" />Class In Ten Minutes? <select name="ClassPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="ApartmentPoster" />Apartment Hunting? <select name="ApartmentPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RoommatePoster" />Roommate Hasn't Paid Up? <select name="RoommatePoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Posters[]" value="RentsPoster" />'Rents Cramping Your Style? <select name="RentsPoster_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Banners</legend>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ClassBanner" />Class In Ten Minutes? <select name="ClassBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="ApartmentBanner" />Apartment Hunting? <select name="ApartmentBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RoommateBanner" />Roommate Hasn't Paid Up? <select name="RoommateBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row1"><input type="checkbox" name="No_Worries_Banners[]" value="RentsBanner" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
   <fieldset><legend>No Worries - Postcards</legend>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ClassPostcard" />Class In Ten Minutes? <select name="ClassPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ApartmentPostcard" />Apartment Hunting? <select name="ApartmentPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
            <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RoommatePostcard" />Roommate Hasn't Paid Up? <select name="RoommatePostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
                <option value="2500">2500</option>
                <option value="3000">3000</option>
                <option value="3500">3500</option>
                <option value="4000">4000</option>
                <option value="4500">4500</option>
                <option value="5000">5000</option>
            </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="RentsPostcard" />'Rents Cramping Your Style? <select name="RentsBanner_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  <div class="row2"><input type="checkbox" name="No_Worries_Postcards[]" value="ForeignPostcard" />Foreign City?<select name="ForeignPostcard_quantity"><option value="0" >-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option>
      <option value="2500">2500</option>
      <option value="3000">3000</option>
      <option value="3500">3500</option>
      <option value="4000">4000</option>
      <option value="4500">4500</option>
      <option value="5000">5000</option>
  </select></div>
  </fieldset>
<br>
<br>
<input type="submit" name="Submit" id="Submit" value="Submit">
 
</form>
</body>
</html>
 
 
<?php
exit;
 
if( !empty($_POST['action']) )
{
	header("Content-type: text/plain");
	$submittedData="";
	foreach($_POST['Standard_Supplies'] as $value)
	{
		$k=$value."_quantity";
		if(!empty($_POST[$k]))
			$submittedData .= "\n".str_replace("_"," ",$value) . ": " . $_POST[$k];
	}
	$submittedData .="\nNo Worries Campaign";
	$submittedData .="\n\tQuantity: " . $_POST['NWC_quantity'];
	$nwc=array('Flyers','Posters','Banners','Post_Cards');
	foreach($nwc as $chk)
	{
		if( !empty($_POST[$chk]) )
		{
			$submittedData .= "\n\t" . $chk.":";
			foreach($_POST[$chk] as $value)
			{
				$submittedData .= "\n\t\t".str_replace("_"," ",$value);
			}
		}
	}
	if(!empty($submittedData))
	{
		//mail("you@yourcompany.com","Order details",$submittedData);
		echo $submittedData;
		echo "\n\nThank you!";
	}
	exit;
}
?>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.row1{float:left;width:25%;}
.col1{float:left;width:49%;}
fieldset{padding:5px;}
fieldset div select{display:block;}
legend{font-weight:bold;background-color:white;}
fieldset fieldset{border:0px; border-top:1px dashed black;margin-top:1em;}
-->
</style>
 
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
	<fieldset><legend>Standard Supplies</legend>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="RateSheet" />Ratesheet <select name="RateSheet_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Table_Drape" />Table Drape <select name="Table_Drape_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div class="row1"><input type="checkbox" name="Standard_Supplies[]" value="Banner_Stands" />Banner Stands <select name="Banner_Stands_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
		<div><input type="checkbox" name="Standard_Supplies[]" value="T_Shirts" />T-Shirts <select name="T_Shirts_quantity"><option value="0">-</option><option value="500">500</option><option value="1000">1000</option><option value="1500">1500</option><option value="2000">2000</option></select></div>
	</fieldset>
 
	<fieldset><legend>No Worries Campaign</legend>
		<div>Quantity: <input type="text" name="NWC_quantity"/></div>
		<fieldset><legend>Flyers</legend>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Flyers[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Flyers[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Flyers[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Posters</legend>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Posters[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Posters[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Posters[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Banners</legend>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Banners[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Banners[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Banners[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
 
		<fieldset><legend>Post Cards</legend>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Class In Ten Minutes?"/>Class In Ten Minutes?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Apartment Hunting?"/>Apartment Hunting?</div>
			<div class="col1"><input type="checkbox" name="Post_Cards[]" value="Roommate hasn't paid up?"/>Roommate hasn't paid up?</div>
			<div><input type="checkbox" name="Post_Cards[]" value="Olds Cramping Your Style?"/>Olds Cramping Your Style?</div>
		</fieldset>
	</fieldset>
	<div><input type="submit" name="action" value="Submit"/></div>
</form>
</body>
</html>

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question