Multi-recipient Email Forms

The need to create an option on forms

Page 1 of 1

7 Replies - 1398 Views - Last Post: 15 March 2002 - 08:22 PM

#1 redbarron  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 03-March 01

Multi-recipient Email Forms

Posted 19 May 2001 - 09:56 PM

Does anyone know how you can use a drop-menu on a form so that a visitor could direct a question to a particular recipient?  The form could be a feedback or questionnaire type of form, but I'm wondering if it's possible to make the drop-menu form element determine who the email will be routed to once the "Submit" button has been clicked.
Thanks in advance ;)
Is This A Good Question/Topic? 0
  • +

Replies To: Multi-recipient Email Forms

#2 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 05:32 AM

Depends on what you're using to mail the form's contents.  With PHP, you could do this:

<?
if(!$submit){
?>

<form action="<? echo $PHP_SELF ?>" method="post">
 From:
 <input name="from"><br>
 Subject:
 <input name="subject"><br><br>
 Message:<br>
 <textarea name="message" rows="8" cols="30"></textarea><br><br>
 To:
 <select name="who">
   <option>---
   <option>Paradox
   <option>RedBarron
 </select><br>
 <input type="submit" name="submit" value="Send">
</form>

<?
}else{

if($who == "Paradox"){
  $email = "paradox@paradoxmedia.net";
}else if($who == "RedBarron"){
  $email = "red@barron.com";
}else{
  die("You did not select who to send a message to");
}

if(!$from or !$subject or !$message or !$to){
  die("Make sure that all the fields are filled in correctly");
}

$send = @mail("$email", "$subject", $message, "From: $from");

if($send){
  $result = "Thanks $from, your message has been sent.";
}else{
  $result = "There was an error in sending your message";
}

echo $result;

}
?>


Above is a script I just wrote to email people.  Type your name, your message, the subject, and select a recipient.

ParadoxMailer
Features:
-Support for unlimited recipients
-Blank field checking
-Error reporting

Preview it

Free for commercial or personal use

...lol

Was This Post Helpful? 0
  • +
  • -

#3 Teckwiz  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: --

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 05:46 AM

hey paradox can u make a script like that one that only mails the form???? i can`t setup anything but php and asp it seems like.....
Was This Post Helpful? 0
  • +
  • -

#4 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 06:58 AM

Hang on I'm testing it
Was This Post Helpful? 0
  • +
  • -

#5 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 07:16 AM

Testing finished!  See my post above.
Was This Post Helpful? 0
  • +
  • -

#6 redbarron  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 03-March 01

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 09:28 AM

Paradox, you rock!  I am extremely new to PHP and ASP.  Ok, I don't know a #### thing, but I studied your posted script very closely and from what I know about Javascript I was able to see how the script worked! It seems very clever and simple (this is what Skyhawk has been telling me about PHP). Anyway, a couple of questions; I see where I would add new email recipients and their addresses. Would I just place this code onto a regular page and it would run by itself or does the IIS server have to have any background languages running (I'm pretty sure Perl is installed)? I'm not on the development machine that I use to manage our school district's site so it's hard to test. Other than changing the recipient's names & addresses, I don't see any other changes I would have to make (I REALLY appreciate what you did!).  Looking forward to the reply :)
Was This Post Helpful? 0
  • +
  • -

#7 Paradox  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 432
  • Joined: 03-March 01

Re: Multi-recipient Email Forms

Posted 20 May 2001 - 04:50 PM

To use the script, save that as a .php file. All that's required to run it is a server that has PHP installed.  If you want to embed it into your existing page, copy and paste it where you want the form to appear and rename the file to .php
Almost everything is editable, if you need help with customization feel free to ask
Was This Post Helpful? 0
  • +
  • -

#8 twurk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-March 02

Re: Multi-recipient Email Forms

Posted 15 March 2002 - 08:22 PM

This is EXACTLY what I need. Unfortunately the server I'm using doesn't have PHP installed :upset:. Can someone suggest a way to do it in javascript or possibly asp? Thx a million ;)

::a dropdown box to select a product and have that selection determine the email recipient

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1