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"?
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.
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.
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)
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 :)