homepage Welcome to WebmasterWorld Guest from 23.22.194.120
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Hidden Email on PHP Form
dvduval




msg:1304923
 12:00 am on Aug 13, 2002 (gmt 0)

I'm pretty sure I've seen this done, but I'm new to learning forms. How can I make it so that my email address (the one the form is sending the message to) cannot be seen, even if the user selects to "view source"?

 

Slade




msg:1304924
 12:36 am on Aug 13, 2002 (gmt 0)

If you have the source to the page you are submitting your form to, you can hard code the destination address in there.

dvduval




msg:1304925
 1:12 am on Aug 13, 2002 (gmt 0)

When you say 'hard code', do you mean define a variable and then request it in the action? Sorry, I'm hoping to get a little more explanation.

bobriggs




msg:1304926
 1:29 am on Aug 13, 2002 (gmt 0)

No request in the action. The variable, which doesn't really make it a variable, is pre-defined in the script. (and therefore not seen by anyone)

transistor




msg:1304927
 3:56 pm on Aug 13, 2002 (gmt 0)

Dvduval,
One way of doing what you want is to place the email address inside the form in a hidden field:
<input type="hidden" name="to" value="myemailaddress">
However, this approach is not quite safe, since anyone can view the source and pick up your address for spam.
Another way of doing it, is to place the email address in your PHP script that sends the mail:

<?
//emailer.php
$to="myemailaddress";
...
?>

These previous methods have the email address "hardcoded".
An open approach would be to get the To: email address from a config.file or a database.
Why is it safer? because PHP code cannot be spidered, it is always interpreted by the server before delivering.
Hope that helps :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved