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 Quote Link to comment 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. Quote Link to comment 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^^ Quote Link to comment Share on other sites More sharing options...
adv Posted November 1, 2007 Author Share Posted November 1, 2007 i got it thanks alot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.