Jump to content

php Contact Form problem


slyguy67

Recommended Posts

Hi,

 

Please could I get some help with the following code, I can't see anything wrong with it and I'm at my wits end!

 

Searched all over Google and have used various scripts but none work - when I upload my Contact.html and mailer.php, I always get an Error 403 when I click "Submit".

 

I'm with 1&1 (beginner package) but it says it supports php so I'm not sure what I'm doing wrong.

 

Contact.html code:

 

<form action="http://www.mywebsite.co.uk/mailer.php" method="post" name="contactform" id="contactform">

       

          <input name="first_name"  type="text" class="SubSubTitle" style="width:205px; background-color: #F0F7FF; border: 1px solid #999; padding: 5px; font: Trebuchet MS, Arial, Helvetica, sans-serif" value="Enter your first name *" size="30" maxlength="50"; />

          <br />

          <br />

          <input name="last_name"  type="text" class="SubSubTitle" style="width:205px; background-color: #F0F7FF; border: 1px solid #999; padding: 5px; font: Trebuchet MS, Arial, Helvetica, sans-serif" value="Enter your last name *" size="30" maxlength="50"; />

          <br />

          <br />

          <input name="email"  type="text" class="SubSubTitle" style="width:205px; background-color: #F0F7FF; border: 1px solid #999; padding: 5px; font: Trebuchet MS, Arial, Helvetica, sans-serif" value="Enter your e-mail address *" size="30" maxlength="80"; />

          <br />

          <br />

          <input name="telephone"  type="text" class="SubSubTitle" style="width:205px; background-color: #F0F7FF; border: 1px solid #999; padding: 5px; font: Trebuchet MS, Arial, Helvetica, sans-serif" value="Enter you telephone number" size="30" maxlength="30"; />

          <br />

          <br />

          <textarea  name="comments" cols="25" rows="6" class="SubSubTitle" style="width:205px; background-color: #F0F7FF; border: 1px solid #999; padding: 5px; font: Trebuchet MS, Arial, Helvetica, sans-serif" maxlength="1000";>Comments *</textarea>

          <br />

          <br />

          <input type="submit" value="Submit" />

        </form>

 

mailer.php code:

 

<?php

  $first_name = $_REQUEST['first_name'] ;

  $last_name = $_REQUEST['Last_name'] ;

  $email = $_REQUEST['email'] ;

  $telephone = $_REQUEST['telephone'] ;

  $comments = $_REQUEST['comments'] ;

 

  mail( "my@email.co.uk", "Enquiry from Your Website",

    $message, "From: $email, Message: $comments" );

  header( "Location: http://www.mywebsite.co.uk/thankyou.html" );

?>

 

Thanks for any help in advance,

 

Mike

 

Link to comment
Share on other sites

Check your file permissions and file ownership. Both files should be owned by the same user and both should probably be set to 744 or 700 or 644.

 

Beware if you're actually intending to use that script on the web outside of a login protected area you WILL find your script being abused/hacked to send out spam.

 

I recommend saving yourself the time and using this:

This site http://www.tectite.com/formmailpage.php offers a great php formmail script and they keep it secure and up to date with email notifications of new security updates and features. Free. Their site also has a configuration wizard to save you time. I used it for years in a professional server environment with no breaches. (because we updated when we were supposed to)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.