Re: Re: A tricky one?
| From: | Joshua Hoover | Date: | Tue, 20 Nov 2001 20:58:14 +0000 |
| Subject: | Re: Re: A tricky one? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75284@lists.php.net to get a copy of this message | ||
If you only want to show the ones variables that have values input by the user, you could do this with the while loop:
while (list($var, $val) = each($HTTP_POST_VARS)) {
if ((strlen($val) > 0) && ($var !="email") && ($var !="SUBMIT") && (isset($var)) {
$message .= "$val $var were ordered \n";
}
}
This will make sure that the string length of $val (the value of the form element) is greater than 0; if not, it won't add it to the message.
Joshua Hoover
It works after modifying it a little. BUT... :) It lists all the variables
even if they aren't given any value. Is it possible to only get the defined
ones?
Regards Raymond
"Matthew Luchak" <MLuchak@Kaydara.com> wrote in message
news:6D3215FF15393442891CAA42DEC51E4944D480@primavera.kaydara.com...
how about...
<?
$message="";
$header="From: $email";
$to="me@here.net";
$subject="burger me";
while(list($var, $val) = each($HTTP_POST_VARS))
{
if(($var !="email")&&($var !="SUBMIT")&&(isset($var)){$message
.="$val $var were ordered \n";}
}
MAIL(
"$to",
"$subject",
"$message",
"$header"
);
?>
____________________________
Matthew Luchak
Webmaster
Kaydara Inc.