473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP Form Help please...????

Hi Guys i could do with some help please, i have the following script but for the life of me i can see to get the form to forward to my email address of *** please help?!?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $owner_email = $_POST["owner_email"];
  3.     $headers = 'From:' . $_POST["email"];
  4.     $subject = 'A message from your site visitor ' . $_POST["name"];
  5.     $messageBody = "";
  6.  
  7.     $messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
  8.     $messageBody .= '<br>' . "\n";
  9.     $messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
  10.     $messageBody .= '<br>' . "\n";
  11.     if($_POST['state']!='nope'){        
  12.         $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
  13.         $messageBody .= '<br>' . "\n";
  14.     }
  15.     if($_POST['phone']!='nope'){        
  16.         $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
  17.         $messageBody .= '<br>' . "\n";
  18.     }    
  19.     if($_POST['fax']!='nope'){        
  20.         $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
  21.         $messageBody .= '<br>' . "\n";
  22.     }
  23.     $messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";
  24.  
  25.     if($_POST["stripHTML"] == 'true'){
  26.         $messageBody = strip_tags($messageBody);
  27.     }
  28.  
  29.     try{
  30.         if(!mail($owner_email, $subject, $messageBody, $headers)){
  31.             throw new Exception('mail failed');
  32.         }else{
  33.             echo 'mail sent';
  34.         }
  35.     }catch(Exception $e){
  36.         echo $e->getMessage() ."\n";
  37.     }
  38. ?>


many thanks!!!!!!!!!!!!
Feb 6 '12 #1
1 1807
Dormilich
8,658 Expert Mod 8TB
have you verified that all input is passed correctly (and the mail() function didn't fail)?

note: mail() only forwards the mail to the sendmail binary (or equivalent). it gives no guarantee that the mail is delivered at all.
Feb 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Airborne | last post by:
I am a newbie. In fact I am in school working on my Java project. Could someone please explain to me how to load a form from another form. I have a main form and from that form I want to show...
4
by: Larry | last post by:
Hi All, How I can open a new web page in a web form? I know response.redirect("...aspx") will re-direct the current page to another. However, what I want is to remain the current page unchange...
8
by: ryan | last post by:
that will make sure all fields are entered. make sure age is between 3- 99 and make sure the email is valid I had a decent search on google, nothing really comes up that is complete. I am...
2
blyxx86
by: blyxx86 | last post by:
I am very new to Access, and have only been using it for a month now. I have learned how to do a lot of things, but have been having problems making a form update a query that then is sent to a...
0
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is...
10
by: Marren02 | last post by:
Hi, I recently just unsubscribed my other thread due to the fact that it went against the posting regulations... If you feel offended by what I posted, I apologize I need Code for a save...
0
by: jake hathaway | last post by:
hello , i am getting this error message "At least one of the From or Sender fields is required, and neither was found." i have added a contact form all the details are correct as far as i no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.