PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi.
I am building a "tell a friend" system, and want to give the user the option to tell up to 5 friends.
But... this isn't working and I am sure it's because of this part of the code.
Surely I don't have to do 5 IF statements based on whether email2 != NULL, or email3 !=NULL etc...??
It's probably an easy one to answer but I can't work it out.
It probably is from that part of the code. I have never successfully been able to send stuff to multiple emails at once. An easy way to find out if it works or not is by replacing the ".$_POST['email']." (all five of them) with an actual email. If it works then there must be a problem with the $_POST you have written there.
It turns out it DID work - the server was just terribly delayed.
So no need for the length code from globe (but thanks).
Basically, if there in an email in each variable, it'll pass it. If there isn't, it just sends it to those where there is an occupied variable.
Simple.
And it works better than the tellafriends you can use from free sites. I tried one yesterday and it never even sent the email!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.