|
|
|
|
![]() ![]() |
Jan 10 2005, 08:53 PM
Post
#1
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 36 Joined: 9-November 04 Member No.: 2,202 |
Hey there everyone,
I'm trying to create a website using some PHP. I created an order form for my school company to let people order products this way. Only orders are made - no payments or anything. Now I have create the whole website. It is very simple. Every different product has a different combobox to select the number of items from. Then on the end of the page the client's details are asked. Now I created this PHP file that would handle everything, that is collecting all information and creating a well-formatted e-mail to send to the company's e-mail address. I thought everything I coded was right - but I guess there must be something wrong. When I try it out, the page get redirected to a blank page (though I tell the script to relocate to the website) and no email is sent. I have attached the PHP code (it's quite long so I cut out a part) and I was wondering if any of you can see something wrong with the code that is causing this problem ? CODE <? // requesting client's information $email = $_REQUEST['email']; $name = $_REQUEST['name']; $phone = $_REQUEST['phone']; $GSM = $_REQUEST['GSM']; // getting the product's information $2in1name = "2 in 1 Kaarsen"; $2in1price = 4.00; $2in1 = $_REQUEST['2in1']; $total2in1 = $2in1* $2in1price; $eikaarskleinname = "Eikaars Klein"; $eikaarskleinprice = 4.00; $eikaarsklein = $_REQUEST['eikaarsklein']; $totaleikaarsklein = $eikaarsklein * $eikaarskleinprice; // they are all the same from here - name, price, number and total $gpLMname = "Geurparels Limoen:Meiklokjes"; $gpLMprice = 4.00; $gpLM = $_REQUEST['gpLM']; $totalgpLM = $gpLM * $gpLMprice; //this should be created the email message $message = "Bestelling door $name\n Te bereiken op $phone, of op de GSM $GSM\n \n Bestelling\n \n $2in1 keer $2in1name = $total2in1"; //this should be sending the message mail("spammail@gmail.com", "$name Aromax Bestelling", $message, "From: $email"); header("Location: http://aromax.bizhat.com"); ?> All help will be highly appreciated! Here you can check out the script in action (with the real emailaddress - I have replaced it because I don't like spam ) As you see only the first product would be included in the e-mail for now - I would expand it in the future of course. So selecting only the first items and filling in some details should do it I suppose. Thanks in advance to all! |
|
|
|
Jan 17 2005, 12:44 AM
Post
#2
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 74 Joined: 21-October 04 From: Connecticut Member No.: 1,870 |
you have to separate all variables (or anything other than text) from text with periods and quotes otherwise the PHP parser doesn't know which is which. for instance:
//this should be created the email message $message = "Bestelling door ". $name ."\n Te bereiken op ". $phone .", of op de GSM ". $GSM ."\n \n Bestelling\n \n ". $2in1 ." keer ". $2in1name ." = ". $total2in1; also, i don't trust using $_REQUEST. its better to use either $_POST or $_GET depending on the form method (or $_COOKIE, but i'm not experienced with those). you should check out the PHP online manual from php.net! it'll help you a lot! |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th September 2008 - 05:23 AM |