View Single Post
Old 11-19-2004, 12:01 PM   #1 (permalink)
pixelbend
Too hot in the hot tub!
 
pixelbend's Avatar
 
[PHP] Problem with strings

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?
__________________
But I don't want ANY Spam!
pixelbend is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37