Jump to content

Empty forms


t3l

Recommended Posts

Hi there.

 

I'm here cuz I need some help. I made a feeback form that should send entered info to my email - i get the email but it fields are blank. It says

Name

Email

Subscribe

Unsubscribe

Feedback

 

But it doesn't write down what I filled in. Which is pretty useless for a form I must say!

 

Any ideas appreciated. Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/136283-empty-forms/
Share on other sites

<?php

/* subject and email variables */

$emailSubject = 'Feedback from Telemika.com';
$webMaster = '[email protected]';

/* Gathering Data Variables */

$emailField = $_POST['email'];
$subscribeField = $_POST['subscribe'];
$unsubscribeField = $_POST['unsubscribe'];
$nameField = $_POST['name'];
$feedbackField = $_POST['feedback'];

$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Subscribe: $subscribe <br>
Unsubscribe: $unsubscribe <br>
Feedback: $feedback <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as HTML */


$theResults = <<<EOD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Thanks!</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #000000;
}
.contact {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #484848;
text-decoration: none;
font-weight: normal;
letter-spacing: 1px;
}
.art {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FF3399;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.artroll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.multimedia {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #9933FF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.multimediaroll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.work {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #00CC00;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.workroll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.news {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFF00;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.newsroll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.bio {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FF3300;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.bioroll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.shop {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #00CCFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.shoproll {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
letter-spacing: 1px;
padding-bottom: 5px;
}
.oneColFixCtrHdr #container {
width: 960px;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.newstext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFF00;
text-decoration: none;
letter-spacing: 1px;
padding-top: 2px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 10px;
border-top-color: #A6A6A6;
}
.newsframe {
border: 1px dotted #00CC00;
}
.worktext {color: #009933}
.style1 {color: #009933; font-weight: bold; }
.style3 {color: #009933; font-size: 12px; }
-->
</style>
</head>

<body class="oneColFixCtrHdr">

<div id="container">
  <div id="header">
    <table width="718" height="580" align="center">
      <tr>
        <td width="710" height="14"><div align="center" class="contact">
          <p><a href="mailto:[email protected]" class="contact">Telephoto | Photography & Multimedia | [email protected] | +44(0)12345678</a></p>
        </div></td>
      </tr>
      <tr>
        <td height="33"><table width="706" height="27" border="0" align="center" bgcolor="#000000" class="menu">
          <tr>
            <td width="107" height="23" class="art"><div align="center" class="art"><a href="art.html" class="art">Art</a></div></td>
            <td width="139" height="23" class="work"><div align="center" class="multimedia"><a href="multimedia.html" class="multimedia">Multimedia</a></div></td>
            <td width="122" height="23" class="news"><div align="center" class="work"><a href="work.html" class="work">Work</a></div></td>
            <td width="116" height="23" class="shop"><div align="center" class="news"><a href="news.html" class="news">News</a></div></td>
            <td width="98" height="23" class="bio"><div align="center" class="bio"><a href="bio.html" class="bio">Bio</a></div></td>
            <td width="98" class="bio"><div align="center" class="shop"><a href="shop.html" class="shop">Shop</a></div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="21"><div align="center">
          <table width="720" height="503" border="0" class="newsframe">
            <tr>
              <td valign="top" class="newstext"><p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center" class="style1"> </p>
                <p align="center" class="style3">Success!</p>
			<p align="center" class="style3">You request has been sent.</p> 
                <p align="center" class="style3">Thanks for your interest!</p>
                <p align="center"> </p>
                <p align="center" class="worktext"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center" class="worktext"> </p>
                <p align="center"> </p></td>
            </tr>
          </table>
        </div></td>
      </tr>
    </table>
  </div>
  <!-- end #container -->
  </body>
</html>
      </tr>
      <div id="footer">
    <table width="718" height="23" align="center">
      <tr>
        <td width="710" height="14"><div align="center" class="contact">
          <p><a href="feedback.html" class="contact" target="_blank">-Subscribe | Feedback-</a></p>
        </div></td>
</div>
</body>
</html>
EOD;
echo "$theResults";	

?>

 

(the tags are


not [ code ][ /code ] -- ken)

Link to comment
https://forums.phpfreaks.com/topic/136283-empty-forms/#findComment-710960
Share on other sites

The reason we use the [ code ] [ /code ] tags is that we do not have to scroll forever just to look at the code. Please do this from now on.

 

<?php

/* subject and email variables */

   $emailSubject = 'Feedback from Telemika.com';
   $webMaster = '[email protected]';

/* Gathering Data Variables */

   $emailField = $_POST['email'];
   $subscribeField = $_POST['subscribe'];
   $unsubscribeField = $_POST['unsubscribe'];
   $nameField = $_POST['name'];
   $feedbackField = $_POST['feedback'];
   
   $body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Subscribe: $subscribe <br>
Unsubscribe: $unsubscribe <br>
Feedback: $feedback <br>
EOD;

   $headers = "From: $email\r\n";
   $headers .= "Content-type: text/html\r\n";
   $success = mail($webMaster, $emailSubject, $body, $headers);
   
/* Results rendered as HTML */


   $theResults = <<<EOD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Thanks!</title>
<style type="text/css">
<!--
body {
   font: 100% Verdana, Arial, Helvetica, sans-serif;
   background: #666666;
   margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
   padding: 0;
   text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
   color: #000000;
   background-color: #000000;
}
.contact {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #484848;
   text-decoration: none;
   font-weight: normal;
   letter-spacing: 1px;
}
.art {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FF3399;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.artroll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.multimedia {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #9933FF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.multimediaroll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.work {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #00CC00;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.workroll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.news {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFF00;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.newsroll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.bio {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FF3300;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.bioroll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.shop {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #00CCFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.shoproll {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFFFF;
   text-decoration: none;
   font-weight: bold;
   letter-spacing: 1px;
   padding-bottom: 5px;
}
.oneColFixCtrHdr #container {
   width: 960px;
   margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
   border: 1px solid #000000;
   text-align: left; /* this overrides the text-align: center on the body element. */
}
a:link {
   text-decoration: none;
}
a:visited {
   text-decoration: none;
}
a:hover {
   text-decoration: none;
}
a:active {
   text-decoration: none;
}
.newstext {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 10px;
   color: #FFFF00;
   text-decoration: none;
   letter-spacing: 1px;
   padding-top: 2px;
   padding-right: 5px;
   padding-bottom: 5px;
   padding-left: 10px;
   border-top-color: #A6A6A6;
}
.newsframe {
   border: 1px dotted #00CC00;
}
.worktext {color: #009933}
.style1 {color: #009933; font-weight: bold; }
.style3 {color: #009933; font-size: 12px; }
-->
</style>
</head>

<body class="oneColFixCtrHdr">

<div id="container">
  <div id="header">
    <table width="718" height="580" align="center">
      <tr>
        <td width="710" height="14"><div align="center" class="contact">
          <p><a href="mailto:[email protected]" class="contact">Erika T. Bergère | Photography & Multimedia | [email protected] | +44(0)7910122945</a></p>
        </div></td>
      </tr>
      <tr>
        <td height="33"><table width="706" height="27" border="0" align="center" bgcolor="#000000" class="menu">
          <tr>
            <td width="107" height="23" class="art"><div align="center" class="art"><a href="art.html" class="art">Art</a></div></td>
            <td width="139" height="23" class="work"><div align="center" class="multimedia"><a href="multimedia.html" class="multimedia">Multimedia</a></div></td>
            <td width="122" height="23" class="news"><div align="center" class="work"><a href="work.html" class="work">Work</a></div></td>
            <td width="116" height="23" class="shop"><div align="center" class="news"><a href="news.html" class="news">News</a></div></td>
            <td width="98" height="23" class="bio"><div align="center" class="bio"><a href="bio.html" class="bio">Bio</a></div></td>
            <td width="98" class="bio"><div align="center" class="shop"><a href="shop.html" class="shop">Shop</a></div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="21"><div align="center">
          <table width="720" height="503" border="0" class="newsframe">
            <tr>
              <td valign="top" class="newstext"><p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center" class="style1"> </p>
                <p align="center" class="style3">Success!</p>
            <p align="center" class="style3">You request has been sent.</p>
                <p align="center" class="style3">Thanks for your interest!</p>
                <p align="center"> </p>
                <p align="center" class="worktext"> </p>
                <p align="center"> </p>
                <p align="center"> </p>
                <p align="center" class="worktext"> </p>
                <p align="center"> </p></td>
            </tr>
          </table>
        </div></td>
      </tr>
    </table>
  </div>
  <!-- end #container -->
  </body>
</html>
      </tr>
      <div id="footer">
    <table width="718" height="23" align="center">
      <tr>
        <td width="710" height="14"><div align="center" class="contact">
          <p><a href="feedback.html" class="contact" target="_blank">-Subscribe | Feedback-</a></p>
        </div></td>
</div>
</body>
</html>
EOD;
echo "$theResults";   
   
?> 

Link to comment
https://forums.phpfreaks.com/topic/136283-empty-forms/#findComment-710968
Share on other sites

And if you still can't figure it out add this;

 

   $emailField = $_POST['email'];
   $subscribeField = $_POST['subscribe'];
   $unsubscribeField = $_POST['unsubscribe'];
   $nameField = $_POST['name'];
   $feedbackField = $_POST['feedback'];

 

before the code I gave you first of all!

Link to comment
https://forums.phpfreaks.com/topic/136283-empty-forms/#findComment-711016
Share on other sites

Thank you. I replaced the entire thing with premiso's code but the data fields were still blank. So I tried adding the above piece of code and the one you gave me before but I'm still getting blank emails... Does it have something to do with spry verification (which I have not done)?

Link to comment
https://forums.phpfreaks.com/topic/136283-empty-forms/#findComment-711034
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.