im trying to create a form as part of a web site, and i have an idea to list the 3 email addresses that are needed in a drop down menu and when the form is submitted the email goes to the selected person. any ideas how i would do this and whether or not i can, forms have never been my strong point.

Recommended Answers

All 3 Replies

<select name='email_address'>
<option value='bob@myplace.com'>Email Bob</option>
<option value='bill@myplace.com'>Email Bill</option>
<option value='ben@myplace.com'>Email Ben</option>
<option value='burt@myplace.com'>Email Burt</option>
</select>

duh thats more than three
but you get the idea

yeah i know how to create the drop down menu just not sure how to get the send button to send it to the selected one. sorry i should have mentioned that.

form handling in the browser is predefiend
the submit button on a form
sends
text, textarea : name & contents pair
select, checkbox,radio button : name & value pair of selected item

the post array will include
post
($email_address)
with the value of the selected item with no further coding needed,

<form action='./emailhandler.php' method='post'>
<select name='email_address'>
<option value='bob@myplace.com'>Email Bob</option>
<option value='bill@myplace.com'>Email Bill</option>
<option value='ben@myplace.com'>Email Ben</option>
<option value='burt@myplace.com'>Email Burt</option>
</select>
<br>From <input type='text' name='from'><br>
from email <input type='text' name='from_email'><br>
message <textarea cols='50' rows='8' name='message'></textarea>
<br>
<input type='submit' value='send email'></form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.