Here is my problem. I am making a recipe box page on our website for our company. It has one input for the submitter's name, one for the title, 14 ingredients list (each of which contain a input for number, pull down for measurement, and an input for ingredient) and one large text box for instructions.
Here is what I have coded on the php side so far:
Code:
<?
//Recipe box emailer
$submitter = $_POST["submitter"];
$rectitle = $_POST["title"];
$instructions = $_POST["instructions"];
$amt1 = $_POST["amt1"];
$size1 = $_POST["size1"];
$ing1 = $_POST["ingred1"];
if ($ing1 != ""){ $ingList1 = "1. $amt1 $size1 of $ing1\n";}
else{$ingList1 = "";}
$Form_date= date ("l, F d, Y H:i");
$Form_email= "anemail@adomain.net";
$Form_headers= "From:anotheremail@adomain.net";
$Form_emailsubject= "Submitted Recipe";
$Form_message= "
Submitter: $submitter \n
Recipe: $rectitle \n
Ingredient List: \n
$ingList1
Instructions: \n$instructions \n";
mail ($Form_email, $Form_emailsubject, $Form_message, $Form_headers);
header ("Location:http://www.somesite.com/");
?>
Now I can put all 14 ingerdients in ingList2, ingList3...etc, but I feel there must be a more elegant way to do this (read: a lot less typing). I was thinking of putting them into an array, but how can you concatenate the $_POSTs?