Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Design Forum > HTML / CSS
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 10-23-2008, 09:19 AM   #1 (permalink)
pathfinder_05
Junior Member
 
pathfinder_05's Avatar
 
Join Date: Sep 2008
Posts: 17
Default clientside or serverside for e mail form

Hi guys,

As a newbie I'm quite proud to say I can sort out most things by using Google, but there are so many options when it comes to sending a form from my new website to my e mail address!

There are JS scripts, php, cgi things.....

Which one is the simplest but safest option and do you know the best place to find a ready made script?

Many thanks.

DB
pathfinder_05 is offline   Reply With Quote
Sponsored Links
Old 10-23-2008, 08:34 PM   #2 (permalink)
fnacotton
Junior Member
 
fnacotton's Avatar
 
Join Date: Sep 2008
Location: USA
Posts: 59
Default Re: clientside or serverside for e mail form

It is my opinion that server side form handling is the easiest and safest to implement. Some users like to browse without javascript turned on for some reason. This is a pretty simple form, no validation, but it asks for a name, email, and a short message. The action is set to the path of a mail.php file. In the mail.php file you'll see that it gets the values of the form based on the names assigned to the inputs, then emails them to you, and returns the user to some page.

Code:
your form
<form action="mail.php" method="post">
<label for="name">name:</label> <input type="text" id="name" name="name"><br>
<label for="email">email:</label> <input type="text" id="email" name="email"><br>
<label for="message">message:</label> <textarea name="message" id="message"></textarea><br>
<input type="submit" value="send">
</form>
Code:
for a script called mail.php
<?php
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$body = "
$name
$email
$message";
mail("youremail@address.com", "Email subject", $body, "From: $email"); header("Location: http://www.whereyouwanttheirbrowsertogo.com/thanks.html");
?>
__________________
FNA Cotton, fna
CSS help | cool t-shirts | portfolio

Last edited by fnacotton; 10-23-2008 at 08:36 PM..
fnacotton is offline   Reply With Quote
Old 10-24-2008, 08:26 AM   #3 (permalink)
pathfinder_05
Junior Member
 
pathfinder_05's Avatar
 
Join Date: Sep 2008
Posts: 17
Default Re: clientside or serverside for e mail form

Many thanks for typing that lot out (or copying and pasting).

I'll give it a go now.

DB
pathfinder_05 is offline   Reply With Quote
Old 10-25-2008, 02:26 PM   #4 (permalink)
fnacotton
Junior Member
 
fnacotton's Avatar
 
Join Date: Sep 2008
Location: USA
Posts: 59
Default Re: clientside or serverside for e mail form

I did a quick little demo that has the files for download so you can see how they all work together.

Simple Form Handling with PHP
__________________
FNA Cotton, fna
CSS help | cool t-shirts | portfolio
fnacotton is offline   Reply With Quote
Old 10-27-2008, 01:26 AM   #5 (permalink)
aathuls
Junior Member
 
Join Date: Oct 2008
Posts: 53
Default Re: clientside or serverside for e mail form

Server Side programming are more advanced and complex.
__________________
aathuls
aathuls is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules

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

Points Per Thread View:
Points Per Thread:
Points Per Reply:



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:59 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums