Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 06-07-2009, 11:21 AM   #1
Daemon Poster
 
Join Date: May 2009
Posts: 690
Smile Email Form help

I am trying to put an Email Form on my web site the kind that you would fillout and then Hit submit and it will Automaticly e mail it to me.

But all I come across is forms that you need to have some kind of .PhP File put in your CGi Bin and then code your page.

And I tryed it and the Form never comes up right on my page and it never e mails it to me.

Then I see all over the net that this kind of Email Form never realy works.

So does anyone know of a way I can maybe do it by hand with HTML Code and not have to use all this ather Files and CGi Bins????
Thanks
__________________

biferi is offline   Reply With Quote
Old 06-07-2009, 12:15 PM   #2
Fully Optimized
 
vampist's Avatar
 
Join Date: Oct 2008
Location: USA
Posts: 2,404
Default Re: Email Form help

Php is a program you will run on a server.
It allows you to code in Php code
Code:
<?php ?>
I don't believe you can do this in just html.

Php 5
Securing Php
Php email form
__________________

__________________
Everyone's Favorite Turd xD
ET: "Phone home!"
Geek: "ping 127.0.0.1"

"If that guy knew half the $h*t that I know, his fuzzy little head would explode. " - Matthew Farrell
vampist is offline   Reply With Quote
Old 06-07-2009, 03:13 PM   #3
Daemon Poster
 
wmorri's Avatar
 
Join Date: May 2007
Posts: 1,066
Send a message via AIM to wmorri
Default Re: Email Form help

Truth be told you will need to have some type of action script for a form to really function well. You don't need a very complicated script for the form to work.

If you give me some information on what exactly you are looking for I can try and put together something that will work for you.

Cheers!
__________________
LEARN BY DOING NOT BY FOLLOWING DIRECTIONS!
Linux Forever!

I thought you were a hispanic/african american? Who is the white guy in the pictures?
wmorri is offline   Reply With Quote
Old 06-07-2009, 04:41 PM   #4
Daemon Poster
 
Join Date: May 2009
Posts: 690
Smile Re: Email Form help

I just want a Form that has a Box to type their Name in.
And a box to type their Masssage in.

Then they will hit submit and it will e mail it to me by it'self.

And I don't know how to put up a picture??
biferi is offline   Reply With Quote
Old 06-07-2009, 06:43 PM   #5
Daemon Poster
 
wmorri's Avatar
 
Join Date: May 2007
Posts: 1,066
Send a message via AIM to wmorri
Default Re: Email Form help

Hi,

Ok, give me a day or so and I will put something together for you. It might not be exactly what you want but I will give you a template for you. I will make the php script work for you reguardless of how you change the form.

Cheers!
__________________
LEARN BY DOING NOT BY FOLLOWING DIRECTIONS!
Linux Forever!

I thought you were a hispanic/african american? Who is the white guy in the pictures?
wmorri is offline   Reply With Quote
Old 06-08-2009, 03:28 AM   #6
Wizard of Wires
 
setishock's Avatar
 
Join Date: Feb 2005
Location: Not sure
Posts: 10,030
Default Re: Email Form help

What software for your website are you using? Sounds a little like VB's Contact Us which appears at the bottom of the main index page.
That can get hit by spammers if it's not protected by a human challenge like re-captcha or something like it.

Also you might check over at www.dynamicdrive.com and see if they have something already put together that would work.
setishock is offline   Reply With Quote
Old 06-08-2009, 01:19 PM   #7
Daemon Poster
 
wmorri's Avatar
 
Join Date: May 2007
Posts: 1,066
Send a message via AIM to wmorri
Default Re: Email Form help

Hi,

Here is what I have for the form so far. I think that it should work, I am just working on the php now.

Code:
<form action="email.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Message:<br />
<textarea name="message" rows="25" cols="50"></textarea><br/>
<input type="submit" />
</form>
Cheers!
__________________
LEARN BY DOING NOT BY FOLLOWING DIRECTIONS!
Linux Forever!

I thought you were a hispanic/african american? Who is the white guy in the pictures?
wmorri is offline   Reply With Quote
Old 06-09-2009, 09:25 AM   #8
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: Email Form help

wmorri is spot on for the form. When you set the form's method to post, the inputs are posted back to the server. The code in your email.php file would look like this:
PHP Code:
$from "sender@mysite.com";
$to "recipientEmail@domain.com";
$subject "Thanks for your submission!";
$body "Thank you " $_POST['name'] . " for contacting us!";
$adminTo "you@yourdomain.com";
$adminBody "A user has requested information:<br />\n";
$adminBody .= "Name: " $_POST['name'] . "<br />\n";
$adminBody .= "Message: " $_POST['message'] . " <br />\n";
$headers  "From: $from\r\n";
$headers .= "Content-type: text/html\r\n"
mail($to,$from,$body,$headers); // sends the e-mail
mail($adminTo,$from,$adminBody,$headers); // send an administrative e-mail. 
I didn't run that, but if memory serves, thats all you need aside from configuring the php.ini file to point to a default mail server to handle the request.

It sends two e-mails. One to the user letting them know you received their submission, and one to you informing you that you received one.

the headers (content-type) allows you to put html in the e-mail instead of plain text. the built-in "mail" function I used returns 1 on success and false on failure. You could put this in an if statement to check and see if the operation completed.

Hope this helps.

Also notice the $_POST[] variable. This is a global variable that exists on every post back to the server. It is an array whose contents are the form values that were posted back. The 'text' part that goes in the square braces corresponds to the name="" attribute of your input element in your form.
So $_POST['name'] in your case, pulls whatever value they entered into the <input type="text"> field where it's name="" attribute equals "name".
In wmorri's code:
Code:
<input type="text" name="name" />
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 06-09-2009, 01:41 PM   #9
Daemon Poster
 
wmorri's Avatar
 
Join Date: May 2007
Posts: 1,066
Send a message via AIM to wmorri
Default Re: Email Form help

Daeva,

Thanks for doing the php part for me. I am not to good with php yet. I usually have some friends that help me with that.

Cheers!
__________________
LEARN BY DOING NOT BY FOLLOWING DIRECTIONS!
Linux Forever!

I thought you were a hispanic/african american? Who is the white guy in the pictures?
wmorri is offline   Reply With Quote
Old 06-09-2009, 01:43 PM   #10
Daemon Poster
 
Join Date: May 2009
Posts: 690
Smile Re: Email Form help

Can we go step by step because these thingsa never work for me.
So I just want to make sure I am doing it right??

Everything in the PhP File you have listed I type say in Notepad and save it as . PhP right??

What do I have to Ad Or Change??

Just tell me this first.

Thanks.
__________________

biferi is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off



All times are GMT -5. The time now is 05:43 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0