Forms +mail()
Moderator: General Moderators
Forms +mail()
Hi,
Basically I have a form with losts of fields and check boxed, but a great number wont have any data input upon submision. When I use mail() to email me a copy of the form as well as the client I only want to email the fields that contained data along with a short description ie
$message = "name: $name";
whats the easyest way to do that?
Cheers
Basically I have a form with losts of fields and check boxed, but a great number wont have any data input upon submision. When I use mail() to email me a copy of the form as well as the client I only want to email the fields that contained data along with a short description ie
$message = "name: $name";
whats the easyest way to do that?
Cheers
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
These two functions are used to check if data exists in a variable.
Everything gets sent, it's just that some will be empty.
It's usually a good idea to use these in form validation if you're not using a more in-depth validation method too.
http://www.php.net/empty
http://www.php.net/isset
Everything gets sent, it's just that some will be empty.
It's usually a good idea to use these in form validation if you're not using a more in-depth validation method too.
http://www.php.net/empty
http://www.php.net/isset
Try looping through the name and value pairs like this
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | te;$key = $value <br>";
}
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
d11wtq | Please use
Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color]Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color]a]806a]
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color].= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value &1]
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= h the name and value pairs like thisCode: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color]18b806a]
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entereairs like thisCode: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color]h the name and value pairs like thisCode: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color:16on to send the data. If you want only entered data to go to the $msg variables ( not empty data ) thenCode: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // s like thisCode: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}{
$msg .= "$key = $value <br>";
}
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}}
Then use the mail function to send the data. If you want only entered data to go to the $msg variables ( not empty data ) then
Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <b
foreach($HTTP_POST_VARS as $key=>$value)
{
$msg .= "$key = $value <br>";
}Code: Select all
foreach($HTTP_POST_VARS as $key=>$value)
{
if(strlen($value) > 1){ // only entered datas will be taken
$msg .= "$key = $value <br>";
}
}Code: Select all
tags when posting PHP code [/color]