|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Recently I had to restructure a database and split it into two tables. Since then, the mail() function that I have in one of my pages won't work properly.
The email will send, but none of the variables appear. The code is: Code:
$body = "Company Name just received an online order from {$_POST['customer_name']}.";
mail("name@url.com", "Order Received", $body, "From: info@url2.com");
Can anyone point me in the right direction? |
|
||||
|
Compound variables always provide a syntax chalange when dealing with quotes, you can simplify the code by first turning it into a simple variable $customer_name = $_POST['customer_name']; then use it ($customer_name) in your code.
also see http://ca3.php.net/manual/en/ref.mail.php for more info on the mail function.
__________________
Irony: That for most people the most "trusted" web site on the planet is for a company the has been convicted of criminal activity. Both Security and SuSe start with "S". www.oldslides.com |
|
|||
|
I haven't seen the rest of the code and I don't know what you've tried, but I'm assuming when the email arrives it has the line "Company Name just received an online order from" but no customer name.
Does $_POST['customer_name'] have a value set for it? You can display your post variables by adding var_dump($_POST); to the script if customer_name is not in the list or does not have a value then that's where you need to start looking. |
|
|||
|
OMG whats that?
Check your other post with regards escaping. Check the escape after the word from. Also If I could recommend you used variables for things like email address and site name. These could be stored in a config file and reused sitewide. Also if your site ever changes address or you sell an application (many years away) , you can config the site from a single file. Also when making mail dont forget to add header information. So config.php <?php $email = "email_address_here"; $site_url = "site_url_here"; ?> <?php //call config file include("config.php"); //make email now you have email var + any others you may need $body = "Company Name just received an online order from ."$_POST['customer_name']; mail("name@url.com", "Order Received", $body, "From:".$email); ?> Untested, but should be fine. Excuse if not, just done 16 hrs coding with GD Lib and Geomapping. Heads-a-shed. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |