For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > Mail-form problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mail-form problem
Joker

2004-07-18, 8:55 am

Hello,

I'm trying to make a mail-form with PHP. But the point is I want a function
so the user can choose the receiver (adress) with a drop-down menu box.

example: http://www.battaniye.net/?git=5

How can I program this in PHP ??

Can someone help me?


Thanks.


H.

2004-07-22, 8:55 am

Joker wrote:

> Hello,
>
> I'm trying to make a mail-form with PHP. But the point is I want a function
> so the user can choose the receiver (adress) with a drop-down menu box.
>
> example: http://www.battaniye.net/?git=5
>
> How can I program this in PHP ??


That's fairly simple...
Assuming you have your addresses in a database, you select everything
(or those entries which the user is allowed to send mail to), loop over
the result and put every entry into an HTML select box.


***snip***
<select name='sendTo'>

<?php
$query = "SELECT display_name, address FROM email_adresses)";
$result = mysql_query($query);
while (list($dispName, $email) = mysql_fetch_row($result))
{
echo("<option value='".$email."'>".$dispName."</option>");
}
?>

</select>
***snap***

H.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com