(1) i have some php code (SEE BELOW) which emails the contents of a form to me..
the form is located at http://www.mitchellpage.com.au/vital.htm.
as you can see there are a lot of fields for Product code, Description and Quantity.
The problem is that when it emails me, it puts the Product code, Description and Quantity all on seperate lines... for example;
Product_code1: 1244325
Description1: panadol
Quantity1: 44
Product_code2: 5532344
Description2: neurofen
Quantity2: 3
is there a way to change the PHP code below so it puts each Product code, Description and Quantity on the same line in the email...
(2) ALSO, in the form there are MANY fields for Product code, Description and Quantity. even if these fields dont get filled in, the email still contains their names but displays no value next to name. for example;
Product_code3:
Description3:
Quantity3:
Product_code4:
Description4:
Quantity4:
is there also a way to ensure that fields that are left blank are not sent in the email??
Below is the PHP script:.......
<?
$recipient = "mitchellpage@optusnet.com.au";
if ($_SERVER['REQUEST_METHOD']=="POST"){
$msg="Values submitted by the user:\n";
foreach($_POST as $key => $val){
if (is_array($val)){
$msg.="Item: $key\n";
foreach($val as $v)
$msg.=" $v\n";
} else
$msg.="$key: $val\n";
}
$subject=$subject;
error_reporting(0);
if (mail($recipient, $subject, $msg, "From: $email\nReply-To: $email\nX-Mailer: PHP/")){
header("Location:$redirect");
}
else {
die("An error occurred and the message could not be sent");
}
}
else {
die("Bad request method");
}
?>
THANKYOU!!!