PDA

View Full Version : Help with contact form



Yamba
23-12-2007, 03:02 PM
Hello, I am creating a contact form for my site but I tried to test it and it would not work. I was wondering if anyone could help me? I here's the codes:


<?php
$Habbo Name = ($_POST["Habbo Name"]);
$Email = ($_POST["E-mail"]);
$Reason for contacting us = ($_POST["Reason"]);
$Message = ($_POST["Message"]);
$to = "[email protected]";
$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 ($Habbo Name== "")
{
echo "Whoops! You didn't enter your Habbo Name.";
exit;
}

if ($Email == "")
{
echo "Whoops! You didn't provide us with an e-mail";
exit;
}
if ($Reason for contacting us == "")
{
echo "Whoops! You didn't say why you're contacting us!";
exit;
}
if ($Message == "")
{
echo "Whoops! You didn't write anything!";
exit;
}

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



<form action="form.php" method="post">
<p>Habbo Name:
<input name="Habbo Name" type="text" maxlength="15">
</p>
<p>E-mail: <input type="text" name="E-mail">
</p>
<p>Reason for contacting us:
<select name="Reason" id="Reason">
<option selected>Please select an option</option>
<option>I have a question about Habblog</option>
<option>I have detected an error on the site</option>
<option>Complaint</option>
<option>Compliment</option>
<option>Link my fansite please</option>
<option>I am submitting an idea</option>
<option>Other </option>
</select>
</p>
<p>Message: <textarea name="Message" cols="30" id="Message">Type your message here</textarea>
</p>
<p><input type="submit" name="SubmitForm" value="Submit Form">
&nbsp; </p>
</form>

Pazza
23-12-2007, 03:05 PM
I'm not a wizz but I don't think 'post' works in IE6 or above ....

Im not sure if thats just HTML form though

MrCraig
23-12-2007, 03:32 PM
change $reason for contacting us to $reason

Yamba
23-12-2007, 03:37 PM
change $reason for contacting us to $reason

Would that matter ?

MrCraig
23-12-2007, 03:50 PM
yes..

$reason for contacting

means jibberish.

'for' is a loop and contacting is just some random word.

Yamba
23-12-2007, 08:04 PM
There's a PHP form maker script on cPanel so I may just use that and see...

MrCraig
23-12-2007, 08:08 PM
One on cpanel is crap.

try http://www.tele-pro.co.uk/scripts/contact_form/

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