Mail Form help!

This is a discussion on "Mail Form help!" within the PHP Forum section. This forum, and the thread "Mail Form help! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 24th, 2007, 13:13
Junior Member
Join Date: Aug 2007
Location: Clearwater, FL
Age: 24
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Mail Form help!

Hey guys. I did a search, and am reading on w3schools.com, but i don't quite understand how to code it...

I have a site with a form. The form is just one text box where visitors can type their email addy in, and I'd like for that address to then be sent to my email address.

here's the code for the form:
Code: Select all
<form action="http://lb.bcentral.com/ex/manage/subscriberprefs.aspx" method="post">
<div align="left">
<img src="pictures/pen2.jpg" alt="" height="70" width="145" border="0">
<br>
<label><font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">b
</font>
<font size="2" color="#021832" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Type your email below:</font>
<font size="2" color="#021832"> 
</font>
</label> 
<input type="text" name="email"> 
<input type="hidden" name="customerid" value="46559"> 
<input type="submit" value="SIGN UP" style="background-color:white;color:black;front-weight:bold">
</input>
</div>
</form>
The server that we used to use for the form was cancelled, so we need to redo it somehow. Thanks for the help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 24th, 2007, 13:27
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

In its most simple of forms with no security you could use


PHP: Select all

//In the php file

<?php

if (!empty($_POST['signUp']) && !empty($_POST['email']) && !empty($_POST['customerid']) && is_numeric($_POST['customerid']))
{

   
//send the email

 
mail ('youremail@thisdomain.com''This is the subject of the message''Customer ' $_POST['customerid'] . 'has given an email address of : ' $_POST['email']);
}

?>
.......................html file
<form action="url of php file" method="post">
<div align="left">
<img src="pictures/pen2.jpg" alt="" height="70" width="145" border="0">
<br>
<label><font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">b
</font>
<font size="2" color="#021832" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Type your email below:</font>
<font size="2" color="#021832"> 
</font>
</label> 
<input type="text" name="email"> 
<input type="hidden" name="customerid" value="46559"> 
<input type="submit" value="SIGN UP" style="background-color:white;color:black;front-weight:bold" name="signUp">
</input>
</div>
</form>
It's pretty simple at its basic level. Create a PHP file with the above code(although I wouldn't recommend using it in its current form) and point the form action at that file.

Assuming your host has php and php mail functions configured, it will send a plain text email to the given address.

Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 24th, 2007, 13:39
Junior Member
Join Date: Aug 2007
Location: Clearwater, FL
Age: 24
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

Thanks a lot. When I click submit, it just opens the php file in the window and shows the code...what am i doing wrong! lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 24th, 2007, 13:43
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

Could be one of two things

1) You didn't save the file as a .php extenstion
2) Your server is not set up for php.

The .php tells the server to execute the php code.

Cheers.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 25th, 2007, 19:45
Junior Member
Join Date: Jul 2007
Location: Los Angeles
Age: 31
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

Based on the sample code you provided your form is being submitted to an ASP.NET page so PHP obviously won't work.


http://lb.bcentral.com/ex/manage/subscriberprefs.aspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 27th, 2007, 14:35
Junior Member
Join Date: Aug 2007
Location: Clearwater, FL
Age: 24
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

Quote:
Originally Posted by imagn View Post
Based on the sample code you provided your form is being submitted to an ASP.NET page so PHP obviously won't work.


http://lb.bcentral.com/ex/manage/subscriberprefs.aspx
Yes...but...

Quote:
Originally Posted by ClrWtrDsgnr
The server that we used to use for the form was cancelled, so we need to redo it somehow. Thanks for the help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Sep 27th, 2007, 21:22
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Mail Form help!

Quote:
Originally Posted by ClrWtrDsgnr View Post
The server that we used to use for the form was cancelled, so we need to redo it somehow. Thanks for the help.
Have you got a new server with php installed?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail Form Synoptic PHP Forum 2 Jun 11th, 2008 21:16
PHP Form Mail Maverick25r PHP Forum 2 Sep 22nd, 2006 21:59
Can someone help me with this e-mail form??? johnson8707 PHP Forum 4 Jul 4th, 2006 17:51
visitors name not displayed in mail after filling in mail form made on earth PHP Forum 7 Nov 16th, 2005 22:43
E-mail form ??????? pittypatter Web Page Design 3 Apr 11th, 2005 23:42


All times are GMT. The time now is 08:54.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42