My form nearly works but not quite. The success page is missing

Yeah, I was testing the form. OK, it’s interesting that it arrives, yet you still get the server error. Most discussions about this online tell you either to—

a) contact your host or
b) check your server’s error log to see what the error was

Antony, please give this page a run and tell us how it fails. Thanks.

You will probably have to correct some file names.


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome To The Ashton Under Lyne Golf Club Website: Change of Address</title>
    <link rel="stylesheet" href="http://www.c5d.co.uk/clubstyle.css" type="text/css" media="screen">
    <link rel="stylesheet" href="http://www.c5d.co.uk/MenuMatic.css" type="text/css" media="screen">
    <script src="http://www.c5d.co.uk/mootools-1.2.5-core-yc.js" type="text/javascript"></script>
    <script src="http://www.c5d.co.uk/MenuMatic_0.68.3.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
window.addEvent('domready', function() {
    var myMenu = new MenuMatic();
});
</script>
<div id="wrapper">
    <div id="container" class="container">
<!-- BEGIN menu.php INCLUDE -->
        <div class="span-24">
            <div id="pagemenucontainer">
                <ul id="pagemenu" class="menu">
                    <li><a href="http://www.c5d.co.uk/addresschange.php">Change of Address</a></li>
                    <li><a href="http://www.c5d.co.uk/contactagc.php">Contact Us</a></li>
                    <li><a href="http://www.c5d.co.uk/directionstoclub.php">Directions</a></li>
                </ul>
            </div>
        </div>
        <div id="header" class="span-24">
            <div class="span-12">
                <img class="clubphoto" src="http://www.c5d.co.uk/clubhouse.jpg" alt="clubhouse" height="210" width="950">
            </div>
        </div>
        <div class="span-24">
            <div id="navcontainer">
                <ul id="nav" class="menu">
                    <li><a href="/index.php"><img src="http://www.c5d.co.uk/home.gif" alt="home"></a></li>
                    <li><a href="index.php">Visitors' Info</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/coursehistory.php">Club History</a></li>
                            <li><a href="http://www.c5d.co.uk/clubhousefacilities.php">Clubhouse Facilities</a></li>
                            <li><a href="http://www.c5d.co.uk/society-menu.php">Society Menu</a></li>
                            <li><a href="http://www.c5d.co.uk/dresscode.php">Dress Code</a></li>
                            <li><a href="http://www.c5d.co.uk/greenfees.php">Green Fees</a></li>
                            <li><a href="http://www.c5d.co.uk/teetime.php">Book A Tee Time</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/course.php">Course</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/course.php">Course Photos</a></li>
                            <li><a href="http://www.c5d.co.uk/clubcard.php">Card</a></li>
                            <li><a href="http://www.c5d.co.uk/clubrecord.php">Course Record</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/clubcompetitions.php">Club Comps</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/winners2012.php">Major Trophy Winners 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/nov2012.php">Competition Results November 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/dec2012.php">Competition Results December 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/jan2013.php">Competition Results January 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/feb2013.php">Competition Results February 2013</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/clubteams.php">Club Teams</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/teammatches2013.php">A &amp; B Team Matches 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/seniorteam.php">Senior Fixtures 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/dunham.php">Dunham Forest Trophy 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/mos.php">Mail on Sunday Knock Out 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/dmf.php">Daily Mail Foursome Knock Out 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/cityglass.php">City Glass Foursomes 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/archie.php">Archie Preston Trophy 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/bmw.php">Williams BMW Junior Challenge 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/teammatches2012.php">A &amp; B Team Results 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/ladiesteam.php">Ladies Team 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/juniorteam.php">Junior Team 2012</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/opens.php">Opens 2013</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/gentsopens.php">Gentlemen's Open Competitions 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/ladiesopens.php">Ladies' Open Competitions 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/mixedopens.php">Mixed Open Competitions 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/seniorsopens.php">Senior Open Competitions 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/junioropen.php">Junior Open Competition 2013</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/events.php">Club Diary</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/calendar.php">Gentlemen's Events</a></li>
                            <li><a href="http://www.c5d.co.uk/ladiescalendar.php">Laides' Events</a></li>
                            <li><a href="http://www.c5d.co.uk/seniorcalendar.php">Seniors' Events</a></li>
                            <li><a href="http://www.c5d.co.uk/juniorcalendar.php">Juniors' Events</a></li>
                            <li><a href="http://www.c5d.co.uk/social.php">Social Events</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/news.php">News</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/news1112.php">November 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/news1212.php">December 2012</a></li>
                            <li><a href="http://www.c5d.co.uk/news0113.php">January 2013</a></li>
                            <li><a href="http://www.c5d.co.uk/news0213.php">February 2013</a></li>
                        </ul>
                    </li>
                    <li><a href="http://www.c5d.co.uk/sections.php">Club Sections</a>
                        <ul class="sub-menu">
                            <li><a href="http://www.c5d.co.uk/greens.php">Greens Team</a></li>
                            <li><a href="http://www.c5d.co.uk/handicaps.php">Handicap Secretary</a></li>
                            <li><a href="http://www.c5d.co.uk/comps.php">Competitions Team</a></li>
                            <li><a href="http://www.c5d.co.uk/bar.php">Bar &amp; House Secretaries</a></li>
                            <li><a href="http://www.c5d.co.uk/juniors.php">Juniors</a></li>
                            <li><a href="http://www.c5d.co.uk/golfclublinks.php">Related Links</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
<!-- END menu.php INCLUDE -->
        <div class="span-24" id="contentwrap" style="background:#E0E0E0;">
            <div class="span-13">
                <div id="content">
                    <div class="entry">
                        <div id="ai1ec-container" class="ai1ec-container thenly">
                            <h2>Sorry, there was an error!</h2>
<?php
$errors = '';
$myemail = 'antonylambert@c5d.co.uk';//<-----Put Your email address here.
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) {
    $errors .= "\
 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 .= "\
 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:\
 Name: $name \
 Email: $email_address \
 Message \
 $message";
$headers = "From: $myemail\
";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thankyou.php');
exit();
}
echo nl2br($errors); ?>
                        </div>
                    </div>
                </div>
            </div>
            <div class="span-11 last">
                <div class="span-7">
                    <div class="sidebar left-sidebar"></div>
                </div>
                <div class="span-4 last">
                    <div class="sidebaradbox125">
                        <a href="http://www.brsgolf.com/ashtonunderlyne/visitor_availability_month.php"><img class="whatson" src="http://www.c5d.co.uk/whatson.png" alt="book a tee"/></a>
                        <a href="http://www.brsgolf.com/ashtonunderlyne/opens_home.php" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/brsgolf.jpg" alt="Book An Open" /></a>
                        <a href="http://www.howdidido.co.uk" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/howdidido.jpg" alt="How Did I Do" /></a>
                        <a href="http://www.c5d.co.uk/teetime.php"><img src="http://www.c5d.co.uk/tee-time.png" alt="book a tee"/></a>
                        <a href="http://www.c5d.co.uk/hurstweather.php"><img class="ad125" src="http://www.c5d.co.uk/hurstweather.jpg" alt="Weather Widget" /></a>
                        <a href="http://www.c5d.co.uk/teetime.php"></a>
                    </div>
                    <div class="sidebar right-sidebar"></div>
                    <div class="socialboxes">
                        <a href="http://www.facebook.com/home.php?sk=group_152294981498083&amp;ap=1" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/facebook.png" alt="Facebook" height="25" width="130" />FACEBOOK</a>
                    </div>
                    <div class="socialboxes">
                        <a href="http://www.c5d.co.uk/notwitter.php"><img class="ad125" src="http://www.c5d.co.uk/twitter.png" alt="Follow Us" title="Follow Us" style="vertical-align:middle; margin-right:5px;" /></a>
                        <a href="http://www.c5d.co.uk/notwitter.php">Follow Us</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="span-24">
            <div id="footer" style="padding:6px; height:15px;">
                <span style="float:left;">Copyright © Antony Lambert</span>'; echo date('l j F Y - H:ia'); echo '<span style="float:right;"><a href="http://www.c5d.co.uk/hurstpages.php" target="_blank">The Hurst Pages</a> by <a href="http://www.c5d.co.uk" target="_blank">Antony Lambert of C5D</a></span>'
            </div>
        </div>
    </div>
</div>
</body>
</html>


I think we might have done it.

The messages took a long time to come through but eventually they did.

Thanks for all the help.

If you’d like to give it a go as some one from off my site to my e mail address that would be great.

Just type any old rubbish in.

The final bit of this puzzle is just to amend the boxes to get the info I want.

Should be a doddle (;-))) Fingers crossed

Antony

Which boxes do you mean?

Well instead of the box enttitled message, I want

Telephone

Mobile

New Address Line 1

New Address Line 2
New Address Line 3
New Address Line 4
Post Code

Thanks

Antony

Well it was working but now it gives me an error.

I tried to add some boxes as above and whilst I could add a telephone number box, no matter how I tried I couldn’t get it to take any other box for a mobile for example.

Having tried to reverse everything, I now get an error.

[LIST]'; echo nl2br($errors); echo ’
[/LIST]

As far as I know I have reversed everything as it should be

This is the form

<form method=
“POST” name=“contactform” action=“changeofaddress.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>[SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]

<script language=“JavaScript”>[/COLOR][/SIZE][/COLOR][/SIZE]
// Code for validating the form
[I][COLOR=#808000]// Visit http://www.javascript-coder.com/html...lidation.phtml[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#808000][SIZE=2][COLOR=#808000][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
// for details
var frmvalidator
= new Validator[SIZE=2]COLOR=#0000f0
;
frmvalidator
.addValidation(“name”,“req”,“Please provide your name”);
frmvalidator
.addValidation(“email”,“req”,“Please provide your email”);
frmvalidator
.addValidation(“email”,“email”,“Please enter a valid email address”);
</script>

And this is what on the php bit

<?php

$errors =
‘’;
$myemail =
‘antonylambert@c5d.co.uk’;//<-----Put Your email address here.
if(emptyB[/B] || emptyB[/B] || emptyB)[/B] {
$errors .=
"
Error: all fields are required
";
}
$name = $_POST[
'name];
$email_address = $_POST[
'email];
$message = $_POST[
'message];
if (!preg_match("/[1]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) {
$errors .=
"
Error: Invalid email address
";
}
if B[/B] {
$to = $myemail;
$email_subject =
"Contact form submission: $name";
$email_body =
"You have received a new message. "."Here are the details:
Name: $name
Email: $email_address
Message
$message
";
$headers =
"From: $myemail
";
$headers .=
"Reply-To: $email_address";
mailB;[/B]
//redirect to the ‘ackofdetails’ page
header('Location: ackofdetails.php);
exitB;[/B]
}
echo nl2brB;[/B]
?>

Have I missed something ?

Antony


  1. _a-z0-[/SIZE]9[SIZE=2]- ↩︎

What do you mean by “Having tried to reverse everything”? If you want to revert to what you had, just use the code that was posted above.

Adding extra fields is quite easy. Just follow the pattern of the fields that exist now. If there are problems with that, post what you have and we’ll take a look.

I do keep pegging away and I have got the form to send again, but when I try and add more than one field it starts to fail.

I want to add a Telephone Number Field
A Mobile Phone Number Field
Four Lines for a New Address and
A Box for a Post Code.

The code I am using is as above

Antony

Show us your form with the new fields, and also separately post the content of the PHP processing page so we can take a look at what you have now.

OK, no problem.

This is the form bit on page www.c5d.co.uk/addresschange.php

<form method=“POST” name=“contactform” action=“changeofaddress.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=‘contact’>Telephone Number:</label> <br>
<input type=“text” name=“contact”> <br>
</p>
<p>
<label for=‘message’>Message:</label> <br>
<textarea name=“message”></textarea>
</p>
<input type=“submit” value=“Submit”><br>
</form>

This is the content of the php processing page . There is a lot here and much may be superfluous. The problems so far are:

  1. All boxes must be completed or it says Sorry there’s an error. But no reason why !

  2. It doesn’t bring through a phone number. Th einformation is not caaried through.

  3. When I try and add any more boxes it gives echo nl2br($errors);

I am leaving for work now so will not be able to reply again till this evening

Antony

<?php
$errors = ‘’;
$myemail = ‘antonylambert@c5d.co.uk’;//<-----Put Your email address here.
if(empty($_POST[‘name’]) || empty($_POST[‘email’]) || empty($_POST[‘message’])) {
$errors .= "
Error: all fields are required";
}
$name = $_POST[‘name’];
$email_address = $_POST[‘email’];
$telephone_number = $_POST[‘contact’];
$message = $_POST[‘message’];
if (!preg_match(“/[1]+(\.[_a-z0-9-]+)@[a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z]{2,3})$/i”, $email_address)) {
$errors .= "
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:
Name: $name
Email: $email_address
Message
$message”;
$headers = "From: $myemail
";
$headers .= “Reply-To: $email_address”;
mail($to,$email_subject,$email_body,$headers);
//redirect to the ‘ackofdetails’ page
header(‘Location: ackofdetails.php’);
exit();
}
echo nl2br($errors); ?>

<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<title>Welcome To The Ashton Under Lyne Golf Club Website: Change of Address</title>
<link rel=“stylesheet” href=“http://www.c5d.co.uk/clubstyle.css” type=“text/css” media=“screen”>
<link rel=“stylesheet” href=“http://www.c5d.co.uk/MenuMatic.css” type=“text/css” media=“screen”>
<script src=“http://www.c5d.co.uk/mootools-1.2.5-core-yc.js” type=“text/javascript”></script>
<script src=“http://www.c5d.co.uk/MenuMatic_0.68.3.js” type=“text/javascript”></script>
</head>
<body>
<script type=“text/javascript”>
window.addEvent(‘domready’, function() {
var myMenu = new MenuMatic();
});
</script>
<div id=“wrapper”>
<div id=“container” class=“container”>
<!-- BEGIN menu.php INCLUDE –>
<div class=“span-24”>
<div id=“pagemenucontainer”>
<ul id=“pagemenu” class=“menu”>
<li><a href=“http://www.c5d.co.uk/addresschange.php”>Change of Address</a></li>
<li><a href=“http://www.c5d.co.uk/contactagc.php”>Contact Us</a></li>
<li><a href=“http://www.c5d.co.uk/directionstoclub.php”>Directions</a></li>
</ul>
</div>
</div>
<div id=“header” class=“span-24”>
<div class=“span-12”>
<img class=“clubphoto” src=“http://www.c5d.co.uk/clubhouse.jpg” alt=“clubhouse” height=“210” width=“950”>
</div>
</div>
<div class=“span-24”>
<div id=“navcontainer”>
<ul id=“nav” class=“menu”>
<li><a href=“/index.php”><img src=“http://www.c5d.co.uk/home.gif” alt=“home”></a></li>
<li><a href=“index.php”>Visitors’ Info</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/coursehistory.php”>Club History</a></li>
<li><a href=“http://www.c5d.co.uk/clubhousefacilities.php”>Clubhouse Facilities</a></li>
<li><a href=“http://www.c5d.co.uk/society-menu.php”>Society Menu</a></li>
<li><a href=“http://www.c5d.co.uk/dresscode.php”>Dress Code</a></li>
<li><a href=“http://www.c5d.co.uk/greenfees.php”>Green Fees</a></li>
<li><a href=“http://www.c5d.co.uk/teetime.php”>Book A Tee Time</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/course.php”>Course</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/course.php”>Course Photos</a></li>
<li><a href=“http://www.c5d.co.uk/clubcard.php”>Card</a></li>
<li><a href=“http://www.c5d.co.uk/clubrecord.php”>Course Record</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/clubcompetitions.php”>Club Comps</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/winners2012.php”>Major Trophy Winners 2012</a></li>
<li><a href=“http://www.c5d.co.uk/nov2012.php”>Competition Results November 2012</a></li>
<li><a href=“http://www.c5d.co.uk/dec2012.php”>Competition Results December 2012</a></li>
<li><a href=“http://www.c5d.co.uk/jan2013.php”>Competition Results January 2013</a></li>
<li><a href=“http://www.c5d.co.uk/feb2013.php”>Competition Results February 2013</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/clubteams.php”>Club Teams</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/teammatches2013.php”>A & B Team Matches 2013</a></li>
<li><a href=“http://www.c5d.co.uk/seniorteam.php”>Senior Fixtures 2013</a></li>
<li><a href=“http://www.c5d.co.uk/dunham.php”>Dunham Forest Trophy 2013</a></li>
<li><a href=“http://www.c5d.co.uk/mos.php”>Mail on Sunday Knock Out 2013</a></li>
<li><a href=“http://www.c5d.co.uk/dmf.php”>Daily Mail Foursome Knock Out 2013</a></li>
<li><a href=“http://www.c5d.co.uk/cityglass.php”>City Glass Foursomes 2013</a></li>
<li><a href=“http://www.c5d.co.uk/archie.php”>Archie Preston Trophy 2013</a></li>
<li><a href=“http://www.c5d.co.uk/bmw.php”>Williams BMW Junior Challenge 2013</a></li>
<li><a href=“http://www.c5d.co.uk/teammatches2012.php”>A & B Team Results 2012</a></li>
<li><a href=“http://www.c5d.co.uk/ladiesteam.php”>Ladies Team 2012</a></li>
<li><a href=“http://www.c5d.co.uk/juniorteam.php”>Junior Team 2012</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/opens.php”>Opens 2013</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/gentsopens.php”>Gentlemen’s Open Competitions 2013</a></li>
<li><a href=“http://www.c5d.co.uk/ladiesopens.php”>Ladies’ Open Competitions 2013</a></li>
<li><a href=“http://www.c5d.co.uk/mixedopens.php”>Mixed Open Competitions 2013</a></li>
<li><a href=“http://www.c5d.co.uk/seniorsopens.php”>Senior Open Competitions 2013</a></li>
<li><a href=“http://www.c5d.co.uk/junioropen.php”>Junior Open Competition 2013</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/events.php”>Club Diary</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/calendar.php”>Gentlemen’s Events</a></li>
<li><a href=“http://www.c5d.co.uk/ladiescalendar.php”>Laides’ Events</a></li>
<li><a href=“http://www.c5d.co.uk/seniorcalendar.php”>Seniors’ Events</a></li>
<li><a href=“http://www.c5d.co.uk/juniorcalendar.php”>Juniors’ Events</a></li>
<li><a href=“http://www.c5d.co.uk/social.php”>Social Events</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/news.php”>News</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/news1112.php”>November 2012</a></li>
<li><a href=“http://www.c5d.co.uk/news1212.php”>December 2012</a></li>
<li><a href=“http://www.c5d.co.uk/news0113.php”>January 2013</a></li>
<li><a href=“http://www.c5d.co.uk/news0213.php”>February 2013</a></li>
</ul>
</li>
<li><a href=“http://www.c5d.co.uk/sections.php”>Club Sections</a>
<ul class=“sub-menu”>
<li><a href=“http://www.c5d.co.uk/greens.php”>Greens Team</a></li>
<li><a href=“http://www.c5d.co.uk/handicaps.php”>Handicap Secretary</a></li>
<li><a href=“http://www.c5d.co.uk/comps.php”>Competitions Team</a></li>
<li><a href=“http://www.c5d.co.uk/bar.php”>Bar & House Secretaries</a></li>
<li><a href=“http://www.c5d.co.uk/juniors.php”>Juniors</a></li>
<li><a href=“http://www.c5d.co.uk/golfclublinks.php”>Related Links</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!-- END menu.php INCLUDE –>
<div class=“span-24” id=“contentwrap” style=“background:#E0E0E0;”>
<div class=“span-13”>
<div id=“content”>
<div class=“entry”>
<div id=“ai1ec-container” class=“ai1ec-container thenly”>
<h2>Sorry, there was an error!</h2>

                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="span-11 last"&gt;
            &lt;div class="span-7"&gt;
                &lt;div class="sidebar left-sidebar"&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="span-4 last"&gt;
                &lt;div class="sidebaradbox125"&gt;
                    &lt;a href="http://www.brsgolf.com/ashtonunderlyne/visitor_availability_month.php"&gt;&lt;img class="whatson" src="http://www.c5d.co.uk/whatson.png" alt="book a tee"/&gt;&lt;/a&gt;
                    &lt;a href="http://www.brsgolf.com/ashtonunderlyne/opens_home.php" target="_blank"&gt;&lt;img class="ad125" src="http://www.c5d.co.uk/brsgolf.jpg" alt="Book An Open" /&gt;&lt;/a&gt;
                    &lt;a href="http://www.howdidido.co.uk" target="_blank"&gt;&lt;img class="ad125" src="http://www.c5d.co.uk/howdidido.jpg" alt="How Did I Do" /&gt;&lt;/a&gt;
                    &lt;a href="http://www.c5d.co.uk/teetime.php"&gt;&lt;img src="http://www.c5d.co.uk/tee-time.png" alt="book a tee"/&gt;&lt;/a&gt;
                    &lt;a href="http://www.c5d.co.uk/hurstweather.php"&gt;&lt;img class="ad125" src="http://www.c5d.co.uk/hurstweather.jpg" alt="Weather Widget" /&gt;&lt;/a&gt;
                    &lt;a href="http://www.c5d.co.uk/teetime.php"&gt;&lt;/a&gt;
                &lt;/div&gt;
                &lt;div class="sidebar right-sidebar"&gt;&lt;/div&gt;
                &lt;div class="socialboxes"&gt;
                    &lt;a href="http://www.facebook.com/home.php?sk=group_152294981498083&amp;ap=1" target="_blank"&gt;&lt;img class="ad125" src="http://www.c5d.co.uk/facebook.png" alt="Facebook" height="25" width="130" /&gt;FACEBOOK&lt;/a&gt;
                &lt;/div&gt;
                &lt;div class="socialboxes"&gt;
                    &lt;a href="http://www.c5d.co.uk/notwitter.php"&gt;&lt;img class="ad125" src="http://www.c5d.co.uk/twitter.png" alt="Follow Us" title="Follow Us" style="vertical-align:middle; margin-right:5px;" /&gt;&lt;/a&gt;
                    &lt;a href="http://www.c5d.co.uk/notwitter.php"&gt;Follow Us&lt;/a&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="span-24"&gt;
        &lt;div id="footer" style="padding:6px; height:15px;"&gt;
            &lt;span style="float:left;"&gt;Copyright © Antony Lambert&lt;/span&gt;'; echo date('l j F Y - H:ia'); echo '&lt;span style="float:right;"&gt;&lt;a href="http://www.c5d.co.uk/hurstpages.php" target="_blank"&gt;The Hurst Pages&lt;/a&gt; by &lt;a href="http://www.c5d.co.uk" target="_blank"&gt;Antony Lambert of C5D&lt;/a&gt;&lt;/span&gt;'
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

</div>
</body>
</html>


  1. _a-z0-9- ↩︎

Antony, In message #4 in this thread, I gave you detailed instructions for putting code tags around your code postings along with reasons for doing so. Would you please comply with those instructions. It’s OK to help us help you.

I thought I had.

Here are the key pieces. The first is the PHP. The second the HTML code

<?php
$errors = ‘’;
$myemail = ‘antonylambert@c5d.co.uk’;//<-----Put Your email address here.
if(empty($_POST[‘name’]) || empty($_POST[‘email’]) || empty($_POST[‘message’])) {
$errors .= "
Error: all fields are required";
}
$name = $_POST[‘name’];
$email_address = $_POST[‘email’];
$telephone_number = $_POST[‘phone’];
$message = $_POST[‘message’];
if (!preg_match(“/[1]+(\.[_a-z0-9-]+)@[a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z]{2,3})$/i”, $email_address)) {
$errors .= "
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:
Name: $name
Email: $email_address
Message
$message”;
$headers = "From: $myemail
";
$headers .= “Reply-To: $email_address”;
mail($to,$email_subject,$email_body,$headers);
//redirect to the ‘ackofdetails’ page
header(‘Location: ackofdetails.php’);
exit();
}
echo nl2br($errors); ?>

<form method=“POST” name=“contactform” action=“changeofaddress.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=‘phone’>Telephone Number:</label> <br>
<input type=“text” name=“phone”> <br>
</p>
<p>
<label for=‘message’>Message:</label> <br>
<textarea name=“message”></textarea>
</p>
<input type=“submit” value=“Submit”><br>
</form>


  1. _a-z0-9- ↩︎