Forum Moderators: phranque

Message Too Old, No Replies

Help htaccess

         

Rockuuu

9:45 pm on Jul 13, 2011 (gmt 0)

10+ Year Member



Hey Guys:
i need help please in htaccess
i have a very simple HTML design with simple PHP conatct us form , when i fill the form and hit the Submit button i get the Error 403 access forbidden
i googled this i make more than 20 script for htaccess file BUT not a single one make it work

i have no idea about it , would u please help me out here i would really apprciated it

i will post the HTML and PHP script :
Code:

<?php
$errors = '';
$myemail = '*****@****.com';
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}

$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];

if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}

if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";

$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>

<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>


</body>
</html>

the htaccess file is (i tried too many scripts this what is in it NOW)


<Directory />
Allowoverride All
</Directory>

<Location />
Options +IncludesNoExec -ExecCGI
</Location>



the html form

Code:

<form method="POST" name="contactform" action="contact-form-handler.php">
<p>
<label for='name'>Your Name:</label> <br>
<input type="text" name="name">
</p>
<p>
<label for='email'>Email Address:</label> <br>
<input type="text" name="email"> <br>
</p>
<p>
<label for='message'>Message:</label> <br>
<textarea name="message"></textarea>
</p>
<input type="submit" value="Submit"><br>
</form>



maybe in the backage i bought with the hosting i didnt select this kind of services , its from 1AND1 by the way, i really dont know

Best regards

htmlbasictutor

6:49 pm on Jul 17, 2011 (gmt 0)

10+ Year Member



What happens if your take this out?
<Directory />
Allowoverride All
</Directory>

<Location />
Options +IncludesNoExec -ExecCGI
</Location>


I have forms on 1and1 with no problem.