Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 12th Nov 2013, 02:39 PM   #1
Advanced Warrior
War Room Member
 
PLR Basket's Avatar
 
Join Date: 2007
Location: Canada
Posts: 826
Thanks: 73
Thanked 123 Times in 80 Posts
Default
What is wrong with my php form?
Share on: 
fb share twitter share gplus share more share

Hey guys,

I have this php form on my website that doesn't deliver mails to my email address. I've tried using the exact path and file name only within the form tag to no avail. The form seems to work and even redirects to the desired page after processing, but I get no mail. Can you guys help me? Here the form and php file:

Form:


<form id="contact-form" name="contact-form" method="post" action="http://winwinarticles.com/pages/form-processing.php">
<p>
<label>Name:<br />
<input name="Name" type="text" id="FName" size="30" />
</label>
</p>
<p>
<label>Email:<br />
<input name="Email" type="text" id="Email" size="48" />
</label>
</p>
<p>
<label>Paypal transaction ID:<br />
<input name="Paypal" type="text" id="Paypal" size="48" />
</label>
</p>

<p>
<label>Subject:<br />
<input name="Subject" type="text" id="Subject" size="48" />
</label>
</p>

<p>
<label>Keywords list:<br />
<textarea name="Keyword" id="Keyword" cols="50" rows="7"></textarea>
</label>
</p>

<p>
<label>Title list:<br />
<textarea name="Title" id="Title" cols="50" rows="7"></textarea>
</label>
</p>

<p>
<label>Comments/Questions:<br />
<textarea name="Comment" id="Comment" cols="50" rows="7"></textarea>
</label>
</p>
<p>
<label>
<input name="button" type="submit" class="submit-button" id="button" value="Send" />
</label>
</p>
</form>



Php file:

<?php

while (list($key, $val) = @each($_GET)) $GLOBALS[$key] = $val;
while (list($key, $val) = @each($_POST)) $GLOBALS[$key] = $val;
while (list($key, $val) = @each($_COOKIE)) $GLOBALS[$key] = $val;
while (list($key, $val) = @each($_FILES)) $GLOBALS[$key] = $val;
while (list($key, $val) = @each($_SESSION)) $GLOBALS[$key] = $val;

/* Subject and Email Variables */

$emailSubject = 'Order';
$webMaster = 'myemail@hotmail.com';

/* Gathering Data Variables */

$nameField = $_POST['Name'];
$emailField = $_POST['Email'];
$paypalField = $_POST['Paypal'];
$subjectField = $_POST['Subject'];
$keywordField = $_POST['Keyword'];
$titleField = $_POST['Title'];
$commentField = $_POST['Comment'];


$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br>
Paypal transaction ID: $paypalField <br>
Subject: $subjectField<br>
Keywords list: $keywordField<br>
Title list: $titleField<br>
Comments/Questions: $commentField<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
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta HTTP-EQUIV="REFRESH" content="0; url=http://winwinarticles.com/pages/complete.html">
<style type="text/css">
<!--
body {
background-color: #fffff;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #000000;
text-decoration: none;
}
-->
</style>
</head>
<div align="left">
Redirecting you...</div>
</body>
</html>
EOD;
echo "$theResults";

?>


Thank you
PLR Basket is offline  
Unread 12th Nov 2013, 05:06 PM   #2
I Code Stuff
War Room Member
 
dad2four's Avatar
 
Join Date: 2011
Location: Kirkwood, MO USA
Posts: 302
Thanks: 210
Thanked 80 Times in 52 Posts
Default
Re: What's wrong with this php form?
Share on: 
fb share twitter share gplus share more share

replace $email with $emailField and you are good.

Did you used to be on WA?

dad2four is offline  
Unread 13th Nov 2013, 11:11 AM   #3
Advanced Warrior
War Room Member
 
PLR Basket's Avatar
 
Join Date: 2007
Location: Canada
Posts: 826
Thanks: 73
Thanked 123 Times in 80 Posts
Default
Re: What's wrong with this php form?
Share on: 
fb share twitter share gplus share more share

Originally Posted by dad2four View Post

replace with and you are good.

Did you used to be on WA?
I tried changing $emailfield for $email and it still doesn't work. And what is WA?
PLR Basket is offline  
Unread 13th Nov 2013, 12:46 PM   #4
I Code Stuff
War Room Member
 
dad2four's Avatar
 
Join Date: 2011
Location: Kirkwood, MO USA
Posts: 302
Thanks: 210
Thanked 80 Times in 52 Posts
Default
Re: What's wrong with this php form?
Share on: 
fb share twitter share gplus share more share

Originally Posted by Chris Moore View Post

I tried changing for and it still doesn't work. And what is WA?
WA = Wealthy Affiliate and by not knowing you already answered the question.

I uploaded your files to my server and they worked fine once I made that change.

In your response you said $emailfield, in code did you capitalize the F? It will not work if you lower cased it.

dad2four is offline  
Unread 13th Nov 2013, 12:53 PM   #5
I Code Stuff
War Room Member
 
dad2four's Avatar
 
Join Date: 2011
Location: Kirkwood, MO USA
Posts: 302
Thanks: 210
Thanked 80 Times in 52 Posts
Default
Re: What's wrong with this php form?
Share on: 
fb share twitter share gplus share more share

Originally Posted by Chris Moore View Post

I tried changing for and it still doesn't work. And what is WA?
Hey, did you check your spam folder? My tests landed this in my spam folder.

dad2four is offline  
Unread 13th Nov 2013, 01:01 PM   #6
HyperActive Warrior
War Room Member
 
alistair's Avatar
 
Join Date: 2010
Location: England
Posts: 403
Thanks: 152
Thanked 386 Times in 269 Posts
Default
Re: What is wrong with my php form?
Share on: 
fb share twitter share gplus share more share

This may be totally irrelevant as I don't know much about this but I had a similar issue with a contact plugin and after a bit of messing around it turned out that the host I was using didn't allow php mail so I had to use smtp or whatever it is, or something along those lines. Just a thought.
alistair is offline  
Unread 13th Nov 2013, 01:19 PM   #7
Advanced Warrior
War Room Member
 
PLR Basket's Avatar
 
Join Date: 2007
Location: Canada
Posts: 826
Thanks: 73
Thanked 123 Times in 80 Posts
Default
Re: What is wrong with my php form?
Share on: 
fb share twitter share gplus share more share

Originally Posted by alistair View Post

This may be totally irrelevant as I don't know much about this but I had a similar issue with a contact plugin and after a bit of messing around it turned out that the host I was using didn't allow php mail so I had to use smtp or whatever it is, or something along those lines. Just a thought.
That could be the issue because I used the exact same code on my old server and it worked. I'm with Hostgator.

Originally Posted by dad2four View Post

Hey, did you check your spam folder? My tests landed this in my spam folder.
I checked. Nothing there.
PLR Basket is offline  
Unread 13th Nov 2013, 01:33 PM   #8
I Code Stuff
War Room Member
 
dad2four's Avatar
 
Join Date: 2011
Location: Kirkwood, MO USA
Posts: 302
Thanks: 210
Thanked 80 Times in 52 Posts
Default
Re: What is wrong with my php form?
Share on: 
fb share twitter share gplus share more share

I'm with hostgator as well, ran into a similar issue yesterday when they moved my server which I'm sure is what happened to you as well.

dad2four is offline  
Closed Thread


Bookmarks

Tags
form, php, wrong


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:08 PM.