Solved

Adding Mail function to form

Posted on 2008-10-09
17
275 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
Comment Utility
*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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:natsully
Comment Utility
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
Comment Utility
Are you getting an error message at tall?
0
 
LVL 82

Expert Comment

by:hielo
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:natsully
Comment Utility
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
Comment Utility
Change this:

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

... to this:

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

Author Comment

by:natsully
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
Thanks so much!!
You're really helping me out!
Please help me finish it out!!
Thanks!!
0
 
LVL 39

Expert Comment

by:Roger Baklund
Comment Utility
>> "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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now