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
Solved

Adding Mail function to form

Posted on 2008-10-09
17
279 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress French and English Site 6 76
jQuery Sticky Menu 24 36
html input 8 42
MVC - procedural PHP 10 35
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

840 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