473,399 Members | 2,278 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,399 software developers and data experts.

sendmail.php problem

I'm new at using php.

I am creating a basic html "contact us" form using php to send the data securely via email.

I posted the form and the screen turns blank when I hit the "submit" button.

Server is running PHP 5.2 with Mysql 5 and Apache 2
Viewing the page with Mozilla Firefox Browser 2.0
Site is wrapped in a custom tailored CMS based on Cake

Code is below...

sendmail.php code...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   if (isset($_POST['submitted'])) {
  3.     $errors = array(); 
  4.     if (empty($_POST['name'])) {
  5.       $errors[] = 'You did not enter your name.';
  6.     }
  7.     else {
  8.       $name = $_POST['name'];
  9.     }
  10.     if (empty($_POST['email'])) {
  11.       $errors[] = 'You did not enter an email address.';
  12.     }
  13.     else {
  14.       $email = $_POST['email'];
  15.     }
  16.     if (empty($_POST['company'])) {
  17.       $errors[] = 'You enter company name.';
  18.     }
  19.     else {
  20.       $company = $_POST['company'];
  21.     }
  22.     if (empty($_POST['title'])) {
  23.       $errors[] = 'You did not enter a title.';
  24.     }
  25.     else {
  26.       $title = $_POST['title'];
  27.     }
  28.     if (empty($_POST['phone'])) {
  29.       $errors[] = 'You did not your phone number.';
  30.     }
  31.     else {
  32.       $phone = $_POST['phone'];
  33.     }
  34.     if (empty($_POST['projname'])) {
  35.       $errors[] = 'You did not enter your project name.';
  36.     }
  37.     else {
  38.       $projname = $_POST['projname'];
  39.     }
  40.     if (empty($_POST['projectpurp'])) {
  41.       $errors[] = 'You did not enter your project\'s purpose.';
  42.     }
  43.     else {
  44.       $projectpurp = $_POST['projectpurp'];
  45.     }
  46.     if (empty($_POST['operatingsys'])) {
  47.       $errors[] = 'You did not enter operating system.';
  48.     }
  49.     else {
  50.       $operatingsys = $_POST['operatingsys'];
  51.     }
  52.     if (empty($_POST['projdescript'])) {
  53.       $errors[] = 'You did not enter a proj description.';
  54.     }
  55.     else {
  56.       $projdescript = $_POST['projdescript'];
  57.     }
  58.     if (empty($_POST['howfindsite'])) {
  59.       $errors[] = 'You did not enter how you found our site.';
  60.     }
  61.     else {
  62.       $howfindsite = $_POST['howfindsite'];
  63.     }
  64.     if (empty($_POST['deploytimeframe'])) {
  65.       $errors[] = 'You did not enter a deployment timeframe.';
  66.     }
  67.     else {
  68.       $deploytimeframe= $_POST['deploytimeframe'];
  69.     }
  70.  
  71.     if (empty($errors)) { // No errors happened
  72.       $emailmessage = "The following customer inquiry was made:\n
  73.       $name\n$email\n$company\n$title\n$phone\n$projname\n$projpurpurp\n$operatingsys\n$projdescript\n$howfindsite\n$deploytimeframe";
  74.       mail( "name@name.com, name12@name.com", "Identifinder Customer Inquiry",
  75.       "$emailmessage", "From: $email" );
  76.       header( "Location: /identifinder_contact_us/identifinder_contact_form_thank_you" );
  77.     }
  78.     else {
  79.       foreach ($errors as $msg) {
  80.         echo '<li> '.$msg.'</li>';
  81.       }
  82.    }
  83. }
  84. ?>
  85.  
  86.  
contact form html code
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <div class="textWrap">
  10.  
  11.       <h4><span class="highlight">Thank you</span> for your interest in Name Technologies.</h4>
  12.       <h6>We will be in touch with you shortly.</h6>
  13.  
  14.  
  15.  
  16.       <form method="POST" action="/php/sendmail.php">
  17.         <table border="0" cellpadding="0" cellspacing="0">
  18.             <tr>
  19.                 <td>
  20.                     <p class="formlisting">Name:&nbsp;</p>                </td>
  21.                 <td>
  22.                     <input type="text" name="name" value="" size="40" maxlength="64" autocomplete="off" />                </td>
  23.             </tr>
  24.             <tr>
  25.                 <td>
  26.                     <p class="formlisting">E-mail:&nbsp;</p>                </td>
  27.                 <td>
  28.                     <input type="text" name="email" value="" size="40" maxlength="64" autocomplete="off" />                </td>
  29.             </tr>
  30.             <tr>
  31.                 <td>
  32.                     <p class="formlisting">Company:&nbsp;</p>                </td>
  33.                 <td>
  34.                     <input type="text" name="company" value="" size="40" maxlength="64" autocomplete="off" />                </td>
  35.             </tr>
  36.             <tr>
  37.                 <td>
  38.                     <p class="formlisting">Job Title:&nbsp;</p>                </td>
  39.                 <td>
  40.                     <input type="text" name="title" value="" size="40" maxlength="64" autocomplete="off" />                </td>
  41.             </tr>
  42.             <tr>
  43.                 <td>
  44.                     <p class="formlisting">Phone:&nbsp;</p>                </td>
  45.                 <td>
  46.                     <input type="text" name="phone" value="" size="40" maxlength="40" autocomplete="off" />                </td>
  47.             </tr>
  48.  
  49.             <tr>
  50.                 <td>
  51.                     <p class="formlisting">Project Name:&nbsp;</p>                </td>
  52.                 <td>
  53.                     <input type="text" name="projname" value="" size="40" maxlength="40" autocomplete="off" />                </td>
  54.             </tr>
  55.             <tr>
  56.                 <td>
  57.                     <p class="formlisting">Project Purpose:&nbsp;</p>                </td>
  58.                 <td><select name="projectpurp">
  59.                   <option value="">&nbsp;</option>
  60.                   <option value="SEARCH">Internal company prototype</option>
  61.                   <option value="WRDMTH">Research - Academic</option>
  62.                   <option value="MAGADV">Research - Commercial</option>
  63.                   <option value="OTHER">Other - Enter Purpose</option>
  64.                 </select></td>
  65.             </tr>
  66.  
  67.  
  68.  
  69.  
  70.         </p>
  71.  
  72.             <tr>
  73.                 <td>
  74.                     <p class="formlisting">Operating System:&nbsp;</p>                </td>
  75.                 <td>
  76.  
  77.                 <select name="operatingsys">
  78.                 <option value="">&nbsp;</option>
  79.                 <option value="SEARCH">Windows XP</option>
  80.                 <option value="WRDMTH">2003</option>
  81.                 <option value="MAGADV">Linux</option>
  82.                 <option value="OTHER">Other</option>
  83.             </select>                </td>
  84.             </tr>
  85.         </table>
  86.         <p class="formlisting"><br />Please type a few sentences describing the nature of your project</p>
  87.         <p class="formlisting"><textarea name="projdescript" rows="4" cols="54" wrap="virtual"></textarea></p>
  88.         <p class="formlisting">You found our site via:</p>
  89.         <p class="formlisting">
  90.             <select name="howfindsite">
  91.                 <option value="">&nbsp;</option>
  92.                 <option value="SEARCH">Search engine</option>
  93.                 <option value="WRDMTH">Word of mouth</option>
  94.                 <option value="MAGADV">Magazine advertisement</option>
  95.                 <option value="TRDCNF">Trade show/Conference</option>
  96.                 <option value="OTHER">Other</option>
  97.             </select>
  98.         </p>
  99.  
  100.         <p class="formlisting">If a commercial entity, how long until you hope to deploy IdentiFinder commercially?</p>
  101.         <p class="formlisting">
  102.             <select name="deploytimeframe">
  103.                 <option value="">&nbsp;</option>
  104.                 <option value="NOT">not commercial entity</option>
  105.                 <option value="3">3 months</option>
  106.                 <option value="6">6months</option>
  107.                 <option value="1">1 year</option>
  108.                 <option value="unk">unknown</option>
  109.             </select>
  110.         </p>
  111.  
  112.  
  113.         <p style="text-align: center;"><input type="submit" value="Submit" /></p>
  114.     </form>
  115.  
  116. </div>
  117. </body>
  118. </html>
  119.  
May 15 '07 #1
2 1639
pbmods
5,821 Expert 4TB
Heya, kgrenier12. Welcome to TSDN!

My initial guess would be that your script is hitting an error, but it's not set up to display errors (the usual suspect when a script turns up blank). Check out this article:

http://www.thescripts.com/forum/thread629295.html
May 15 '07 #2
Heya, kgrenier12. Welcome to TSDN!

My initial guess would be that your script is hitting an error, but it's not set up to display errors (the usual suspect when a script turns up blank). Check out this article:

http://www.thescripts.com/forum/thread629295.html
My apologies for not doing that BEFORE I sent my message in.

I changed my php settings inside sendmail.php and still receive a blank screen.
I'm hesitant to change the global php ini settings because it's a production site.

I did notice that my file properties on the server are "RW" only not "RWX" do you think that would contribute to the problem? I am currently trying to reset the file property settings inside ftp but have been unsuccessful.

Thanks for your help,
Kgrenier12
May 16 '07 #3

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

Similar topics

4
by: lawrence | last post by:
We're installing a new server at the office and this will be the first server we set up from which we host our website. We got tired of dealing with Interland and decided to bring our hosting...
2
by: Babaloo | last post by:
Hello, I am having a problem with PHP 4.2.2 and RH 8. PHP is working fine except email. I have a test script to send mail, I have sendmail_path = '/usr/lib/sendmail -t -i' set in php.ini,...
6
by: Sumith Bandula | last post by:
Hi all, I am using a simple php script to send a mail. <?php if (mail($to, $sub, $message, $from)) echo "sent mail successfully<br>\n"; ?> It GOES $to = "me@localhost.localdomain"
0
by: Aaron Powell | last post by:
I am writing a program for a study I am doing where I must contact several different organisations stored in a database I compiled, but I need to send each email one at a time so they don't know...
4
by: jim | last post by:
Hello, I am having a problem w/SendMail reporting: " No recipient addresses found in header". Funny thing is though, I properly recieve the email message. Thanks for your help. -jim
2
by: mike | last post by:
I've spent a couple of days on this and I'm to the "bang-my-head 'gainst the monitor and babble in tongues" mode. First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10 I have...
1
by: James Robertson | last post by:
Issue is that I really do not know diddly. Copying and trying to learn as much as I can about VB and ASP2.0. Now the question I have is I created an E-Mail form the sendmail properties in the VB...
3
by: swangdb | last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have Majordomo and Listproc installed on this server and they work. I have several production majordomo and listproc mailing lists...
4
by: Nilesh | last post by:
I have a server in which sendmail gives problem. How do i change php.ini so that i can use exim for mail() System is FC-6.
4
by: Clodoaldo | last post by:
I need to know if an email was refused for whatever reason, it makes no difference. The email is sent to an email address that does not exist in a foreign domain. I can see in the postfix log...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.