Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
simple PHP form - email send not working - total NEWBIE
Old 01-25-2006, 08:02 PM simple PHP form - email send not working - total NEWBIE
Novice Talker

Posts: 8
Trades: 0
First of all, this website I'm working on is the very first serious site I've ever made. So please don't shoot me for posing a stupid question.

On one page of the site I want to let people subscribe to a newsletter if they want to.
To do this I created a form that they can fill out and a simple php script is supposed to email the information to me.
When you press the submit button the webpage shows up that i made to thank the people for subscribing, however I never get anything in my Email!
My site is hosted by GoDaddy, but they say they don't do customer support for scripting issues.
I'll post the code for the form here, so maybe someone can figure out what I'm doing wrong.

HTML Code:
<form action="gdform.php" method="post"> 
<input name="subject" value="Form Submission" type="hidden">
<input name="redirect" value="thankyounewsletter.html" type="hidden"> <input name="Email" value="I typed my email here" type="hidden">
<p>First Name:&nbsp;&nbsp;&nbsp; <input name="FirstName" type="text"></p>
<p>Last Name:&nbsp;&nbsp;&nbsp; <input name="LastName" type="text"></p>
<p>ZIP code:&nbsp; &nbsp;&nbsp;&nbsp; <input name="ZipCode" type="text"></p>
<p>E-Mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<input
name="email" type="text"></p>
<input value="submit" type="submit">
</form>
This is the code for the form on the webpage. I then saved the whole page as newsletter.html.
From what i could gather, i should save it as newsletter.php instead, but if I did that the problem remained, I never get any information in my email.
I also checked to make sure that the gdform.php file is indeed on the server and it is.
Any help with this issue sure would be appreciated!
Hudba is offline
View Public Profile
 
 
Register now for full access!
Old 01-25-2006, 11:49 PM
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Hey Hudba. First of all there's not such thing as a stupid question. The only stupid thing is not asking them when you have a question.

Your form looks fine though to be able to tell what's wrong we're going to need to see what's in gdform.php. That should be where the problem is. It's either there or in the way the two pages are talking to each other. Either way we need to see the other page.

The newsletter pages is fine to be an html page since there's no php on it. Only the pages that have php code on them need to have the php extension.

Post the other page and I'll be happy to take a look and try to figure out what's wrong as I'm sure will many others here.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
View Public Profile Visit vangogh's homepage!
 
Old 01-26-2006, 12:20 PM PHP code
Novice Talker

Posts: 8
Trades: 0
Okay..here is the php code, I didn't change anything on it, because its a file that GoDaddy automatically puts in your directory. They say it should work automatically. All I had to do was go to the godaddy website and put into the hosting settings there what the email address was where I wanted the server to send me the info.

PHP Code:
<?php
$request_method 
$_SERVER["REQUEST_METHOD"];
if(
$request_method == "GET")
{
$query_vars $_GET;
}
elseif (
$request_method == "POST")
{
$query_vars $_POST;
}
reset($query_vars);
$t date("U");
$fp fopen("ssfm/gdform_$t","w");
while (list (
$key$val) = each ($query_vars))
{
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if (
$key == "redirect")
{
$landing_page $val;
}
}
fclose($fp);
if (
$landing_page != "")
{
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
}
else
{
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
?>
Hudba is offline
View Public Profile
 
Old 02-09-2006, 02:59 AM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 2
Trades: 0
Hudba, I have been playing with GoDaddy's PHP form-mailer a bit. Heres a couple stupid things:

1) It takes a while for the email to get through

2) You need to have established your email for the form-mailer through godaddy's admin controls. This page explains how to do it.
http://help.godaddy.com/article.php?...d=GoDaddy&isc=

3) For some reason, I have noticed if the return email address the client fills out is not valid (like they didnt put the @ symbol) the mail doesn't send.

4) It seems you have 2 fields with name="email" That could be messing it up... I also noticed that (in my case) it would NOT send if I capitalized email as the input name
HTML Code:
<!-- good-->
<input name="email" type="text">
HTML Code:
<!-- bad -->
<input name="Email" type="text">
5) your form action says action="gdform.php" Make sure then that the HTML page holding that code is in the same directory (root directory I assume). Otherwise you will have to change the path to like action="../gdform.php" or whatever to make sure it is targeting the .php
(Actually this cannot be the problem, or it wouldnt redirect you)

Heres another helpful link from GoDaddy help:
http://help.godaddy.com/article.php?...og_id=GoDaddy&

Yo

Last edited by yomama360; 02-09-2006 at 03:47 AM..
yomama360 is offline
View Public Profile
 
Old 02-09-2006, 10:36 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 2
Trades: 0
Heres a sneaky way of getting around the "non-valid emails wont send" error (in the GoDaddy form-mailer). Include these in your HTML
Code:
<input type="hidden" name="email" value="Dont_Reply@bogus_email.com"/>

Email: (optional) <br>
<input name="optionalemail" type="text" maxlength="100">
This will not check for a valid address obviously, but no matter what is typed in the "optional" email field, all info will still get sent to you.

Last edited by yomama360; 02-10-2006 at 04:33 AM..
yomama360 is offline
View Public Profile
 
Old 02-09-2006, 11:12 PM Re: simple PHP form - email send not working - total NEWBIE
FutileSoul's Avatar
Ultra Talker

Posts: 383
Location: Michigan
Trades: 0
Here is a PHP MailForm and you can see an example of it at http://futilesoul.smoothmatic.com/contact/contact.php
If you want, you tell me what email to be sent to, the desired subject, and what fields you need and i can send it back to you.
__________________

Please login or register to view this content. Registration is FREE
- The Congregation of Man
FutileSoul is offline
View Public Profile Visit FutileSoul's homepage!
 
Old 02-25-2006, 10:13 AM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 2
Trades: 0
Hi Yomama360,
I have read your post and your reply to Hudba and that gave me a much greater understading of how to set up the gdform.asp ( I used ASP for my site) with godaddy. However, when the email is sent to me it is in an alphabetically order as note by Godaddy:
"NOTE: Keep in mind that our form-mailer script will sort the names of your form items alphabetically when it composes the email message. This is the order of precedence: uppercase letters, lowercase letters, numbers."
My question is how do I disable this order? Is there a code in the gdform that I can change? Thank you both for your great input.
shawny_74 is offline
View Public Profile
 
Old 04-26-2006, 01:20 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 2
Trades: 0
here's some thing you might like

http://www.onetforum.com/formmailer/


1. Support Any HTML Form with unlimited no of Form Feels

2. Support forward to a pre defined web pages for each successful submit or if there was an error.

3. Support simple customizable message display if no pages defend for successful submit or for errors with a Go Back button (link)

4. Display the IP & Browser information of the person who submit the form.

5. Stop User form Submitting black Forms.

6. Support pre-defined email address or automatically use if there is a field call email in the HTML form to use as the Mail From address in the email it send.

7. Email address validation, (validate the syntax of the email address that was submitted)

8. Ability set mandatory form fields.

9. Send the form in HTML table format.

10. Alerts like Blank Form, Blank Mandatory felids etc has been move to java alerts where a Message Box will display the error

11: Include an Image Based Validation to prevent automated form submitting. (Beta)


have fun
__________________
ORBIT NETWORK

Please login or register to view this content. Registration is FREE

The web just got better...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
kalinga is offline
View Public Profile
 
Old 08-10-2007, 05:12 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 1
Trades: 0
Godaddy has the php.ini file configured with all the information.
This is the code to send a email using php is:
PHP Code:
<?
include_once("Mail.php");
...

$to "support@software506.com"
$subject "Email from php";
$body "Hi \n this is a test";

mail($to$subject$body);

...
this just works in the godaddy host, no for test locally.
it works for me.
just try it.
Software506.com is offline
View Public Profile
 
Old 03-06-2008, 05:05 AM Re: simple PHP form - email send not working - total NEWBIE
Skilled Talker

Posts: 52
Name: Delon
Trades: 0
Hi guys,

I've been reading in on a few of the posts so far about "gdform.php", and while I don't have a problem with my form, I need a way of making it work on no matter which server it's placed on.

Let me elaborate a bit further... I have a website that is being hosted by Godaddy... I am selling this website to people with resell rights, and this website has a form on it (this form will allow me to be in contact with those who have purchased from others). When these people purchase this website they won't necessarily use Godaddy as their web host so I doubt gdform.php will work on their server even if it's uploaded up there, and that would render my form useless.

I need a way of having this form send the required information to me no matter which server these people might chose to upload the website to, while still sending to a forwarding email addreass that I have with Godaddy.

I am also open to other suggestions as long as I can get the same result, but if it can be done in such a way that it still continues to send to my Godaddy forwarding address then that would be ideal for me

Thanks guys in advance for you help, looking forward to hearing from you guys.
oceankid is offline
View Public Profile
 
Old 03-06-2008, 12:22 PM Re: simple PHP form - email send not working - total NEWBIE
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
@ocean kid

What software506 wrote should work across hosts.
VirtuosiMedia is offline
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 03-17-2008, 02:06 PM Re: simple PHP form - email send not working - total NEWBIE
Skilled Talker

Posts: 52
Name: Delon
Trades: 0
I'm not really sure, I didn't quite understand what he meant.
oceankid is offline
View Public Profile
 
Old 12-19-2008, 10:10 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 1
Trades: 0
Hey oceankid- if you are still looking for an answer- there is a video tutorial on how to make a php mail() form done by tutvids.com http://www.tutvid.com/tutorials/drea...ormHandler.php

I should mention that there is a severe mistake made on this tute, they make about half a dozen variables with names like $nameField, $phoneField, etc. etc.. but then at one point when he references those variables, he types them in as just $name, $phone, etc... -he forgets to add the 'Field' at the end. Once you adjust that everything worked beautifuly for me, on Godaddy even!!!

Also, I did use software506's script, and it did work as well, after I removed the three ...'s, changed the opening bracket to <?php instead of <?, and added the closing php brackets ?> at the end.

Good Luck!!
badcrocodile is offline
View Public Profile
 
Old 12-20-2008, 12:28 AM Re: simple PHP form - email send not working - total NEWBIE
johniman7's Avatar
President, JLI Media

Posts: 965
Name: John Irving
Trades: 0
I think software506's script is the way to go. I am a PHP newb as well and a buddy of mine wrote me a script custom to my needs in the way that 506's is set up. I was able to look at it and understand everything pretty easily and modify for other sites and applications.

I don't have a clue what that first code posted does. Looks like a lot of work to do the same thing as software506's but again I am new to PHP.
__________________
Cheers, John Irving: My Blog
JLI Media:
Please login or register to view this content. Registration is FREE
| Website Development (Link Coming Soon!)
johniman7 is offline
View Public Profile Visit johniman7's homepage!
 
Old 05-03-2010, 08:35 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 2
Name: Ezequiel
Trades: 0
Hello . fisrt at all i need to say that this is my first time with php . I got a hosting linux plan and and i got this simple php code that should work, but it doesnt. Im really sad because i feel really silly ...im not a pro with this..

The body of the message doesnt get my mail, i just the subtject, the mail from the person.... and and empty email!!
this is the code im working with

PHP Code:
<?php
$name 
$_POST["id"];
$from $_POST["from"];
$message $_POST["msg"];
$subject "wh0w | Contact | " $_POST["objet"];
$msg utf8_decode($msg);
$msg str_replace("\\"""$msg);
$msg stripslashes($msg);
$msg .= "\n";
$body "Message de : " $name ", " $from "\n\n"
$body .= $msg;

mail("ezequielavaro@yahoo.com.ar",$subject,$body);
echo 
"statut=ok";
?>
And...also i got the same file from godaddy . it is on my hosting but i dont know what to do with it.i Also put my email already at godaddy configuration control panel

Does anybody know why i only get empty emails ? how shuold i modify this gdform...should i link with the other php code ? how ?

Thanks

Last edited by chrishirst; 05-09-2010 at 12:07 PM..
Ezekielus is offline
View Public Profile
 
Old 06-03-2010, 05:42 AM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 1
Name: Bud LaROSA
Trades: 0
Hi, I am a newbie. I purchased a template and am having a huge problem getting my contact pg to work. It is just stuck on send... Go Daddy is not helping me at all. I don't know where to turn...
Here is the code, if someone can tell me what to do I would greatly appreciate it.
Regards
Bud

PHP Code:
<?php
$contact_name 
$_POST['name'];
$contact_email $_POST['email'];
$contact_subject $_POST['subject'];
$contact_message $_POST['message'];

if( 
$contact_name == true )
{
    
$sender $contact_email;
    
$receiver "info@nekros-studio.com";
    
$client_ip $_SERVER['REMOTE_ADDR'];
    
$email_body "Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip ";        
    
$extra "From: $sender\r\n" "Reply-To: $sender \r\n" "X-Mailer: PHP/" phpversion();

    if( 
mail$receiver"Flash Contact Form - $subject"$email_body$extra ) ) 
    {
        echo 
"success=yes";
    }
    else
    {
        echo 
"success=no";
    }
}
?>

Last edited by chrishirst; 07-24-2010 at 05:39 PM..
NEKROS is offline
View Public Profile
 
Old 07-21-2010, 10:22 PM Re: simple PHP form - email send not working - total NEWBIE
Junior Talker

Posts: 1
Name: Mo
Trades: 0
I am also a newbie and have following error with my script
i added my email in the control panel for godaddy and still recieve this error. Please help!!!


Warning: mail() [function.mail]: SMTP server response: 554 The message was rejected because it contains prohibited virus or spam content in D:\Hosting\6380341\html\scripts\email.php on line 24
Thank you the email!!!!


PHP Code:
<?php
 $emailSubject 
'email';
 
$webMaster = [EMAIL="'mhoque@schoolnet.com'"]'mhoque@schoolnet.com'[/EMAIL];
  
 
 
 
$firstField $_POST['first\r\n'];
 
$lastField $_POST['last\r\n'];
 
$emailField $_POST['email\r\n']; 
 
$phoneField $_POST['phone\r\n'];

 
$body = <<<EOD
<br><hr><br> 
First: 
$first <br>
Last:  
$last <br>
Email: 
$email <br>
Phone: 
$phone <br>
EOD;
 
$headers "From: $email\r\n";
 
$headers .= "Content-type: text/html\r\n";
 
$success mail($webMaster$emailSubject$body$headers);
 
 
/*  */
 
$theResults = <<<EOD
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Thank you  the email!!!! 
</body>
</html>
EOD;
echo 
"$theResults";
?>

Last edited by chrishirst; 07-24-2010 at 05:39 PM..
mhoque is offline
View Public Profile
 
Closed Thread     « Reply to simple PHP form - email send not working - total NEWBIE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.58473 seconds with 12 queries