PDA

View Full Version : PHP Form Tutorial



мϊкэ
29-05-2005, 11:00 AM
This tutorial is going to explain how to allow people submit forms, without opening there email (Hotmail,Outlook, etc..)
First of all you are going to need a Form like this for example:

<form name="form1" id="form1" method="post" action="confirm.php">
Name:<input type="text" name="Name">
E-mail:<input type="text" name="E-Mail">
Reason:<select name="Reason">
<option selected>- Choose a Reason</option>
<option>// - - - - - - - - - - -</option>
<option>Your Option 1</option>
<option>Your Option 2</option>
<option>Your Option 3</option>
<option>Your Option 4</option>
<option>- - - - - - - - - - - \\</option></select>
Message: <textarea name="message" rows="4" cols="30"></textarea>
URL of File*: <input name="url" type="text" value="http://">
<input name="Send" type="submit" id="Send" value="Send">
<input type="reset" name="Reset" value="Reset">
you can change:

action="confirm.php"
to whatever you want to call your confirm page but it must be saved as .php
now the code for confirm.php

<?php
$receiver = "[email protected]";
if(isset($_POST["send"])){
$name = $_POST['name'];
$website = $_POST['website'];
$email = $_POST['email'];
$msg = $_POST['msg'];
$ip = $REMOTE_ADDR;
$browser = $_SERVER['HTTP_USER_AGENT'];
if(empty($name)){echo("No Name Entered<br />");}
if(empty($email)){echo("No E-Mail Entered<br />");}
if(empty($msg)){echo("No Message Entered<br />");}
if(!empty($name) && !empty($email) && !empty($msg)){
$headers = "MIME-Version: 1.0";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers .= "From: ".$email."";
$message =
"Name: \n" .
"Email: $E-Mail\n" .
"Subject: $Reason\n" .
"Message: $message\n" .
"File URL: $url\n" .
"IP: $ip\n" .
"Browser: $browser";
mail($receiver, "emailsubject", $message);
echo( " Thank you <i>$Name</i> for your E-mail " )
}
}
?>

You will need to change this code to correspond with you/your form, you need to change

$receiver = "[email protected]";
to your email address and you can change

echo( " Thank you <i>$Name</i> for your E-mail " )
to your personalised message !This will only work if you convert some HTML to PHP Click Here (http://www.disipal.net/modules.php?name=PHP-Nuke_Tools&file=index&func=HTMLPHP) to use an online converter!
If you have basic PHP coding knowledge you will know how to change the form and change the confirm page so everything will be submitted but if not just use that form

( :D 2nd Tutorial, hope it helps )

kasi
13-06-2005, 11:06 PM
its too confusing for me lmao. xD

zainx
13-06-2005, 11:21 PM
a form was already created by mentor,
http://www.habboxforum.com/showthread.php?t=26889&highlight=form+tutorial

Cheeseboy76
18-06-2005, 02:55 PM
My brain hurts

Want to hide these adverts? Register an account for free!