Jump to content


Photo

PHP Form HELP


  • Please log in to reply
7 replies to this topic

#1 wiredweb

wiredweb
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2006 - 08:36 PM

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!
Sites By E Web Design
http://www.sitesbye.com.

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 26 June 2006 - 09:11 PM

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( $clinic, $subject, $message, "From: $email" );
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 wiredweb

wiredweb
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2006 - 09:41 PM

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?
Sites By E Web Design
http://www.sitesbye.com.

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 June 2006 - 10:31 PM

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" );


Legend has it that reading the manual never killed anyone.
My site

#5 wiredweb

wiredweb
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2006 - 11:35 PM

Thank you so much for your help. The script now works!!!!
Sites By E Web Design
http://www.sitesbye.com.

#6 timmah22

timmah22
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 26 June 2006 - 11:46 PM

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>
timmah uses [a href="http://wakeupcalls.net" target="_blank"]wake up calls dot net[/a]

#7 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 June 2006 - 11:54 PM

[!--quoteo(post=388274:date=Jun 26 2006, 07:46 PM:name=timmah22)--][div class=\'quotetop\']QUOTE(timmah22 @ Jun 26 2006, 07:46 PM) View Post[/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.
Legend has it that reading the manual never killed anyone.
My site

#8 wiredweb

wiredweb
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 02:39 AM

There are only 2 clinics so I wont need to update the emails.
Sites By E Web Design
http://www.sitesbye.com.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users