Jump to content

[Solved]Emailing form results BUT with some being processed


ajsuk

Recommended Posts

Hey there, I'm having trouble doing what I want to do with emailing some form results.

I know that you can include results as variables with no trouble but the problem comes for me because some of my form results have to be processed with if statements and so on meaning its not always just a direct dump from the form field for example. I'm guessing I need to be using a function or something? I've tried messing with them but I can't seem to get the email message to accept/include anything other than variables and static text.

Any help would be greatly appreciated!

Thanks in advance,

Andy. =)
Link to comment
Share on other sites

Well I would of posted something but its all in my head at the moment.
I havn't really a clue what how to do what I want and so havn't got any examples however I'll throw in what little I think is right...

[code]
function agecheck()
  {
if ($age < 21)
echo $age."(Under age)";
else
echo $age;
  }

$to = "someone@hotmail.com";
$subject = "Test mail";
$message = "Here are the results: $firstname $lastname of agecheck() years old...";
$from = "someonelse@hotmail.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
[code][/code][/code]
Link to comment
Share on other sites

why not just parse the information before the mail()?

[code=php:0]
if ($age < 21) {
    $age .= ' (Under age)';
}

$to = "someone@hotmail.com";
$subject = "Test mail";
$message = "Here are the results: $firstname $lastname of $age years old...";
$from = "someonelse@hotmail.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
[/code]

oh

[quote author=ToonMariner link=topic=121297.msg498371#msg498371 date=1168117532]
Any clues to your actual problem would be even more welcome. A bit of code perhaps? or maybe a prediction as to when it will rain next in Paris? anything, anything at all....
[/quote]

Maybe monday (30% chance)
Link to comment
Share on other sites

[quote author=genericnumber1 link=topic=121297.msg498394#msg498394 date=1168119008]
why not just parse the information before the mail()?
[/quote]

Well, because that'd be too simple/smart for this poor php noob. ;)

Thanks alot! :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.