SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33
  1. #26
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  2. #27
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    • '; echo nl2br($errors); echo '


    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>

    <script language="JavaScript">

    // Code for validating the form
    // Visit http://www.javascript-coder.com/html...lidation.phtml
    // for details
    var frmvalidator
    = new Validator("contactform");
    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(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 'ackofdetails' page
    header('Location: ackofdetails.php');
    exit();
    }
    echo nl2br($errors);
    ?>




    Have I missed something ?


    Antony

  3. #28
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,613
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    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.

  4. #29
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  5. #30
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,613
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    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.

  6. #31
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 .= "\n Error: all fields are required";
    }
    $name = $_POST['name'];
    $email_address = $_POST['email'];
    $telephone_number = $_POST['contact'];
    $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 '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 &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>

    </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>

  7. #32
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,232
    Mentioned
    52 Post(s)
    Tagged
    2 Thread(s)
    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.

  8. #33
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 .= "\n Error: all fields are required";
    }
    $name = $_POST['name'];
    $email_address = $_POST['email'];
    $telephone_number = $_POST['phone'];
    $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 '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>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •