Content Empty in the Contact Form

the mail() function

Moderators: macek, egami, gesf

matrixreality
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Jan 05, 2012 10:17 am

Content Empty in the Contact Form

Postby matrixreality » Thu Jan 05, 2012 10:27 am

Hi! This is my first post here on this forum. I am having issues with the contact form on my website and would like your input on why it's not working properly. Basically once the form is submitted, it comes to the mailbox only with the subject line. All other content doesn't make it. The email is just completely empty. What is the problem?

Here is the PHP script (sendthestupidemail.php):

Code: Select all

<?
       $Name = trim($Name);
       $Name = stripslashes($Name);
       $Email = trim($Email);
       $Email = stripslashes($Email);
       $Phone = trim($Phone);
       $Phone = stripslashes($Phone);
       $Message = trim($Message);
       $Message = stripslashes($Message);
       $Body = $Message . "\n\n" . $Name . "\n" . $Phone;

       mail ("hola@email.com", "Hi, Gorgeous!", $Body, "From: $Email");

?>


And here is the Form HTML:

Code: Select all

<form method="post" action="sendthestupidemail.php">
      <fieldset>
      <table border="0" cellspacing="0" cellpadding="0">
        <tbody>
          <tr>
            <td><label id="name_label" for="name">Name</label></td>
            <td><input id="name" class="REQUIRED" name="Name" size="30" type="text" />
          </tr>
          <tr>
            <td><label id="email_label" for="email">Email</label></td>
            <td><input id="email" class="REQUIRED EMAIL" name="Email" size="30" type="text" /></td>
          </tr>
          <tr>
            <td><label id="phone_label" for="phone">Phone</label></td>
            <td><input id="phone" class="REQUIRED PHONE" name="Phone" size="30" type="text" /></td>
          </tr>
          <tr>
            <td class="message"><label id="message_label" for="Message">Message</label></td>
            <td><textarea id="message" class="REQUIRED" name="Message"></textarea></td>
          </tr>
          <tr class="last">
            <td>&nbsp;</td>
            <td><input id="submit_btn" class="btn" name="submit" type="submit" value="Send →" /></td>
          </tr>
        </tbody>
      </table>
      </fieldset>
    </form>


Can anyone impart their wisdom as to what is wrong here? Thank you!

Webiter
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Jan 02, 2012 2:25 pm
Location: Rep of Ireland
Contact:

Re: Content Empty in the Contact Form

Postby Webiter » Thu Jan 05, 2012 10:52 am

Would $_POST help in lieu of trim..!

$Name = $_POST($Name);
Last edited by Webiter on Thu Jan 05, 2012 12:14 pm, edited 1 time in total.

matrixreality
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Jan 05, 2012 10:17 am

Re: Content Empty in the Contact Form

Postby matrixreality » Thu Jan 05, 2012 11:01 am

Webiter wrote:Would $_POST help in lieu of trim..!
What do you mean by that, Webiter?

Webiter
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Jan 02, 2012 2:25 pm
Location: Rep of Ireland
Contact:

Re: Content Empty in the Contact Form

Postby Webiter » Fri Jan 06, 2012 4:53 am

Edited earlier response yesterday.

rupali
New php-forum User
New php-forum User
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA

Re: Content Empty in the Contact Form

Postby rupali » Fri Jan 06, 2012 5:42 am

<?php
$Name = trim($Name);
$Name .= stripslashes($Name);
$Email = trim($Email);
$Email .= stripslashes($Email);
$Phone = trim($Phone);
$Phone .= stripslashes($Phone);
$Message = trim($Message);
$Message .= stripslashes($Message);
$Body = $Message . "\n\n" . $Name . "\n" . $Phone;

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: '. $from . "\r\n";

mail("hola@email.com","Hi Gorgeous!",$Body,$headers);
?>


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest