Forum Moderators: coopster

Message Too Old, No Replies

A email Form

         

YuviG

11:20 am on May 5, 2007 (gmt 0)

10+ Year Member



Hello friends

I have a html website (on apche server). In contact us page. I want to put a email form. Should it be a .php page or I can put email form in a html page?

Please help me if anybody can gime complete code a contact us form.

Thanks

ayushchd

11:30 am on May 5, 2007 (gmt 0)

10+ Year Member



Hi!

I am also learning PHP....but i m really comfortable wid contact forms....as its the first thing i learned..

if u want to make a php form then u have to save it in .php extension..

code :

$name = $_POST['name'];
$address = $_POST['address'];
$message = $_POST['message'];

$msg = " Name : $name <br> Address : $address <br> Message : $message ";

mail ("example@example.com", "Whatecer the subject", $msg);

name, address and message are the names of the input fields....

Regards,
Ayush

YuviG

4:15 am on May 7, 2007 (gmt 0)

10+ Year Member



thanks buddy ...

but the code u gave me is not a complete code that i can put to a page & it will run ... will it?
i need complete code.

ayushchd

2:33 am on May 9, 2007 (gmt 0)

10+ Year Member



hi..here is the complete code :

<html>
<head>
<title> form </title>
</head>
<body>
<form name="form1" action="" method="post">
Name :<input type="text" name="name" /> <br />
Message :<input type="text" name="message" /> <br />
Address :<input type="text" name="address" /> <br />
<input type="submit" name="submit" />
</form>
</body>
</html>
<?
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$address = $_POST['address'];
$message = $_POST['message'];

$msg = " Name : $name <br> Address : $address <br> Message : $message ";

mail ("example@example.com", "Whatecer the subject", $msg);

}?>

phparion

5:34 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



do not use this code :) .. it is very 'hacker/spammer friendly'... instead do a search on google and make a safe email form. you can download a ready made from <snip> for FREE

[edited by: dreamcatcher at 6:26 am (utc) on May 9, 2007]
[edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]

phparion

10:56 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@YuviG: as I cannot post URLs here in this forum.. so you need to do some effort.. open google and write 'email based contact form' you will get a very good ready made php based email form.. I hope that helps!