Jump to content

PHP Form HELP


wiredweb

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!
Link to comment
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?
Link to comment
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]
Link to comment
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>
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.