Jump to content

Archived

This topic is now archived and is closed to further replies.

wiredweb

PHP Form HELP

Recommended Posts

I am making a prescription refill form for a local vet clinic and there is a drop down menu to choose where the from will be sent but I never recieve the emails of the completed forms. I have tried several different things but nothing works. The form will work with a single email address though.

Here is the code. The form is at [a href=\"http://twinforksclinic.com/prescription.php\" target=\"_blank\"]http://twinforksclinic.com/prescription.php[/a].

<?php

$subject = "Prescription Refill for Twin Forks";
$clinic = $_REQUEST['clinic'];
$owner = $_REQUEST['owner'] ;
$owneremail = $_REQUEST['owneremail'];
$pet = $_REQUEST['pet'] ;
$weight = $_REQUEST['weight'] ;
$phone = $_REQUEST['phone'] ;
$qty1 = $_REQUEST["qty1"];
$heartworm = $_REQUEST['heartworm'];
$qty2 = $_REQUEST["qty2"];
$fleatick = $_REQUEST['fleatick'];
$qty3 = $_REQUEST["qty3"];
$revolution = $_REQUEST['revolution'];
$message = $_REQUEST['message'];

if($clinic == "Benkelman")
$email = "email@twinforksclinic.com";

if($clinic == "Wray")
$email = "email2@twinforksclinic.com";

$message = "Sent From: $owner
Owner Email: $owneremail
Clinic: $clinic
Pet's Name: $pet
Pet's Weight: $weight
Owner's Phone: $phone
Heatworm Qty: $qty1
Heartworm: $heartworm
Flea/Ticky Qty: $qty2
K9: $fleatick
Revolution Qty: $qty3
Revolution: $revolution
Speacial Instructions: $message";
mail( $clinic, $subject, $message, "From: $email" );
header( "Location: [a href=\"http://www.twinforksclinic.com/thankyou.php"\" target=\"_blank\"]http://www.twinforksclinic.com/thankyou.php"[/a] );
?>

Thanks for your help in advance!

Share this post


Link to post
Share on other sites
cuz you aren't sending the email to an email address. $clinic seems to be the name of the clinic, and you are putting the name of the clinic into the "To:" arguement of the mail function

mail( [b]$clinic[/b], $subject, $message, "From: $email" );

Share this post


Link to post
Share on other sites
Thats because $clinic is a drop down menu that goes to this:

if($clinic == "Benkelman")
$email = "email@twinforksclinic.com";

if($clinic == "Wray")
$email = "email2@twinforksclinic.com";


How else can I do it so you can choose which email address it goes to?

Share this post


Link to post
Share on other sites
[code]if($clinic == "Benkelman")
$to_email = "email@twinforksclinic.com";

if($clinic == "Wray")
$to_email = "email2@twinforksclinic.com";

... more code ...
mail( $to_email, $subject, $message, "From: $email" );

[/code]

Share this post


Link to post
Share on other sites
or you could do it the right way so you dont have to update your both php code and html everytime you add an email address.

add a value to your option

<select name="clinic" id="clinic">
<option value="timmah@timmah.com">Benkelman</option>
<option value="timmah2@timmah.com">Wray</option>
</select>

Share this post


Link to post
Share on other sites
[!--quoteo(post=388274:date=Jun 26 2006, 07:46 PM:name=timmah22)--][div class=\'quotetop\']QUOTE(timmah22 @ Jun 26 2006, 07:46 PM) [snapback]388274[/snapback][/div][div class=\'quotemain\'][!--quotec--]
or you could do it the right way...
[/quote]
The obvious disadvantage to that is it exposes all the email addresses to email address searching bots. Helloooo SPAM.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.