adv Posted November 1, 2007 Share Posted November 1, 2007 i got a dillema i have : $message = "name:$name\nlastname:$lastname"; $message .= "hobby:$hobbies"; $mail ($to,$sub,$message); but if they leave empty the hobby i don`t want to send : hooby : <empty> only to send $message = "name:$name\nlastname:$lastname"; and if they complete the hobby send the message completly $message = "name:$name\nlastname:$lastname"; $message .= "hobby:$hobbies"; something like this thanks in advance Link to comment https://forums.phpfreaks.com/topic/75653-solved-how-to-send-mail/ Share on other sites More sharing options...
revraz Posted November 1, 2007 Share Posted November 1, 2007 Do an IF statement after $message = "name:$name\nlastname:$lastname"; and check for a value in $hobbies, if exists, add it, if not, skip it. Link to comment https://forums.phpfreaks.com/topic/75653-solved-how-to-send-mail/#findComment-382819 Share on other sites More sharing options...
kellz Posted November 1, 2007 Share Posted November 1, 2007 you can do: if (!strlen($hobbies) == 0) { something here } or if (!$hobbies == '') { something here } and more.. probably^^ Link to comment https://forums.phpfreaks.com/topic/75653-solved-how-to-send-mail/#findComment-382823 Share on other sites More sharing options...
adv Posted November 1, 2007 Author Share Posted November 1, 2007 i got it thanks alot Link to comment https://forums.phpfreaks.com/topic/75653-solved-how-to-send-mail/#findComment-382949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.