View Single Post
Old 10-23-2007, 11:05 PM   #3 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,258
Thanks: 90
Wildhoney is on a distinguished road
Default

The Javascript splits it up nicely. Trouble with PHP's explode is that it is a superficial action as the email will still be printed in basic HTML - all together. In my PHP example above, you would do something like the following for your link:

Code:
<a href="mail.php?txtMail=adam">Email Adam</a>
It would then call the file with my code contained in it. If all goes well then the header function will relay the end user onto their default email client and open up a new email with the recipient set as the email address I specified in my PHP code under adam. That way the email addresses aren't exposed.

The PHP way is the more efficient method and also the method that will be more widely supported by many browsers. Most browsers, unless you explicitly tell them not to, redirect from the location attribute in the HTTP header response. Whereas, people know how to turn Javascript off with ease (And some browsers do not support Javascript), but disabling the HTTP header is something most people would not know how to do - nor actually want to. Read my header tutorial for further information.

Bottom line? PHP method beats the Javascript method hands down!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote