Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-22-2008, 10:07 AM PHP-Based email form
StickerCharged's Avatar
Novice Talker

Posts: 7
Name: timp
Location: Amish Country, PA
Trades: 0
Hey everyone, I just registered here... I'm pretty new to php but have been playing with HTML for years... I'm the webmaster at stickercharged.com

anyway, I'm looking for an email/contact form for the website... I've found a couple via google, but nothing that matches what I need...

This is my problem; I need a dropdown box so I can select which email to send to (i.e. info@ or webmaster@)... I'd also like a selection of subject lines, which would differ depending on which address the message is being sent to, if that's even possible...

I suppose in worst-case scenario, I could put 2 separate contact forms on the site, but feel like that would clutter it up too much...

Anybody have any ideas?

Thanks in advance. Great looking forum here.
StickerCharged is offline
Reply With Quote
View Public Profile Visit StickerCharged's homepage!
 
 
Register now for full access!
Old 01-23-2008, 08:25 AM Re: PHP-Based email form
Novice Talker

Posts: 13
Location: uk
Trades: 0
Email Form

PHP Code:
<form method="post" action="process.php" enctype="multipart/form-data">
<
select name="email">
  <
option value="email@email.com">Email One</option>
  <
option value="email@email2.com">Email Two</option>
</
select>
<
input type="submit" name="button" id="button" value="Submit" />
</
form

Process.php

PHP Code:
<?php
$to
$_POST['email'];
$subject "Hi!";
$body "Hi,\n\nHow are you?";
if (
mail($to$subject$body)) {
  echo(
"<p>Message successfully sent!</p>");
 } else {
  echo(
"<p>Message delivery failed...</p>");
 }
?>
So you retrieve the selected listbox item using $to= $_POST['email'];then that value will be entered for the delivery address.

bit crude example but hope it helps
ninja2001k is offline
Reply With Quote
View Public Profile
 
Old 02-07-2008, 06:04 PM Re: PHP-Based email form
StickerCharged's Avatar
Novice Talker

Posts: 7
Name: timp
Location: Amish Country, PA
Trades: 0
thanks for the previous reply, ninja.

could anybody help me out by giving me a code for a full email form code so I can look at where to add the necessary email selection drop down? something with a subject line selection would be nice... also, is it possible to change the subject line selections based on what email address is chosen?

for example;
if you pick to email info@, subjects would be something such as "Custom Orders" or "General Inquiries"
whereas if you pick webmaster@, subjects would be like "report broken link" or "help with the site"
something to that effect?

thanks.
StickerCharged is offline
Reply With Quote
View Public Profile Visit StickerCharged's homepage!
 
Reply     « Reply to PHP-Based email form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11867 seconds with 12 queries