On Tuesday, November 18, 2003, at 04:30 AM, David Buchmueller wrote:

I am looking for a canned php form which hides the recipient email from
prying eyes. Everything I have found uses a hidden field.


You couldn't write one yourself?


The key is to store the email address' in a server-side array or DB, and only give them the option of seeing the address' related name or id in the form, rather than the address itself.

Build the form:
<?
$addr[] = array('Reception','[EMAIL PROTECTED]');
$addr[] = array('Justin French','[EMAIL PROTECTED]');
$addr[] = array('Bob Smith','[EMAIL PROTECTED]');
$addr[] = array('Marketing','[EMAIL PROTECTED]');
?>
<select name='to'>
<?
foreach($addr as $k => $p)
        {
        echo "<option value='{$k}'>{$person[0]}</option>\n";
        }
?>
</option>


After the form is submitted, you match the recipient ID with an email address server side, and send the email with mail().


<?
$id = $_POST['to']; // eg 3
$to = "{$addr[$id][0]} <{$addr[$id][1]}>; // eg Bob Smith <[EMAIL PROTECTED]>
?>



A basic form (once you know what you're doing) shouldn't take more than 15-20 minutes... then add in some email address validation [1], make sure all fields were completed, add in a site-wide header and footer, make sure everything validates to whatever DOCTYPE you're using, and all is well.


Better still, rather than something canned, you will fully understand your script, and will be able to customise it to suit any situation as needed.

1. http://www.killersoft.com/downloads/pafiledb.php?action=viewall


Justin French


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to