PDA

View Full Version : Contact Form



Yamba
21-12-2007, 09:03 PM
Hey people, I am starting up my own Habbo Blog site called Habblog and I am in need of a contact form. Unfortunately, my PHP skills cannot be said to be more than amateur and so I was wondering if any of you guys know of any tutorial sites that assists you in creating a form.....

+Rep for all help given, thanks

:)

loserWILL
21-12-2007, 09:08 PM
Here you go:



<?php
// The variables
$name = ($_POST["name"]);
$why = ($_POST["why"]);
$to = "YOUREMAIL";
$message = "Name: $name<br />
Why: $para
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";";

if ($_GET["action"] == "submit")
{
if ($name== "")
{
echo "Whoops! You didn't enter your name.";
exit;
}

if ($why == "")
{
echo "Whoops! You didn't type out why!";
exit;
}

echo "MK. If the user inputs the data properly, this'll show.";
mail($to,$subject,$message,$headers);
exit;
}

// The form
echo "<form action=\"?action=submit\" method=\"post\">
<div id=\"title\">Name:</div>
<input type=\"text\" name=\"name\"><br /><br />
<div id=\"title\">Why:</div>
<style=\"width=\"169\"; height=\"116\"><textarea rows=\"7\" input type=\"text\" name=\"why\" cols=\"28\"></textarea><br />
<input type=\"submit\" name=\"submit\" value=\"Submit\"></form>";
?>


I'm pretty sure that'll work.

Yamba
21-12-2007, 09:11 PM
Thanks, I will see how I get on with that... ;) +Rep

loserWILL
21-12-2007, 09:12 PM
Thanks, I will see how I get on with that... ;) +Rep

Thank you, post back if it doesn't work.

Yamba
21-12-2007, 09:18 PM
I was looking for like a form similar to that of Club Habbo:

http://www.clubhabbo.net/clubhabbo/submitcontact.php

Habbo Name:
Email:
Contact Reason: (Drop Down Box)
Message:

loserWILL
21-12-2007, 09:27 PM
Just edit mine? Here's what you want though:


<?php
// The variables
$name = ($_POST["name"]);
$email = ($_POST["email"]);
$reason = ($_POST["reason"]);
$question = ($_POST["question"]);
$to = "YOUREMAIL";
$message = "Name: $name<br />
Email: $email <br />
Reason: $reason <br />
Question: $question";
$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "rn";

if ($_GET["action"] == "submit")
{
if ($name== "")
{
echo "ono! You didn't enter your name.";
exit;
}

if ($email == "")
{
echo "ono! You didn't type out your email!";
exit;
}
if ($reason == "")
{
echo "ono! You didn't say why you're contacting!";
exit;
}
if ($question == "")
{
echo "ono! You didn't write anything!";
exit;
}

echo "MK. If the user inputs the data properly, this'll show.";
mail($to,$subject,$message,$headers);
exit;
}

// The form
echo "<form action=\"?action=submit\" method=\"post\">
Name:
<input type=\"text\" name=\"name\"><br />
Email:
<input type=\"text\" name=\"email\">
<div id=\"title\">Your Reason:</div>
<select name=\"reason\">
<option id=\"rs1\">Reason 1</option>
<option id=\"rs2\">Reason 2</option>
<option id=\"rs3\">Reason 3</option>
<option id=\"rs4\">Reason 4</option>
</select>
<div id=\"title\">Question:</div>
<style=\"width=\"169\"; height=\"116\"><textarea rows=\"7\" input type=\"text\" name=\"question\" cols=\"28\"></textarea>
<input type=\"submit\" name=\"submit\" value=\"Submit\"></form>";
?>

Jamesy
21-12-2007, 09:55 PM
Hey people, I am starting up my own Habbo Blog site called Habblog and I am in need of a contact form. Unfortunately, my PHP skills cannot be said to be more than amateur and so I was wondering if any of you guys know of any tutorial sites that assists you in creating a form.....

+Rep for all help given, thanks

:)

If it is for wordpress there is a nice plugin that does the job fantastically.

http://jamesysblog.net/?page_id=3

See, but my host is down at the minute. Crap.

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