If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Aug 2011
    Member #
    Hello all,

    Excuse me if I posted this in the wrong forum but my issue has to due with both JS and php, the nature of the problem is when submitting the form the page supposed to stay open well the accordion should stay open to see the thank you message and then redirect to another page. I hope someone understands what I'm trying to say here. any ways the code is below.

    PHP Code:

    // Set email variables
    $email_to '';
    $email_subject 'Form submission';

    // Set required fields
    $required_fields = array('fullname','email','comment');

    // set error messages
    $error_messages = array(
    'fullname' => 'Please enter a Name to proceed.',
    'email' => 'Please enter a valid Email Address to continue.',
    'comment' => 'Please enter your Message to continue.'

    // Set form status
    $form_complete FALSE;

    // configure validation array
    $validation = array();

    // check form submittal
    if(!empty($_POST)) {
    // Sanitise POST array
    foreach($_POST as $key => $value$_POST[$key] = remove_email_injection(trim($value));

    // Loop into required fields and make sure they match our needs
    foreach($required_fields as $field) {
    // the field has been submitted?
    if(!array_key_exists($field$_POST)) array_push($validation$field);

    // check there is information in the field?
    if($_POST[$field] == ''array_push($validation$field);

    // validate the email address supplied
    if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation$field);

    // basic validation result
    if(count($validation) == 0) {
    // Prepare our content string
    $email_content 'New Website Comment: ' "\n\n";

    // simple email content
    foreach($_POST as $key => $value) {
    $key != 'submit'$email_content .= $key ': ' $value "\n";

    // if validation passed ok then send the email

    // Update form switch
    $form_complete TRUE;

    validate_email_address($email FALSE) {
        return (
    preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i'$email))? TRUE FALSE;

    remove_email_injection($field FALSE) {
       return (
    str_ireplace(array("\r""\n""%0a""%0d""Content-Type:""bcc:","to:","cc:"), ''$field));

    <!DOCTYPE html>
    <html lang="en">
    <title>GMG Stone</title>
    <meta charset=utf-8>
    <link href="contact/css/contactform.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link  href=",bold" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="../js/jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="../js/menu.js"></script>
    <script type="text/javascript" src=""></script>
    <script type="text/jscript" src="contact/validation/validation.js"></script>
    <script type="text/javascript">
    var nameError = '<?php echo $error_messages['fullname']; ?>';
            var emailError = '<?php echo $error_messages['email']; ?>';
            var commentError = '<?php echo $error_messages['comment']; ?>';
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    <body onload="MM_preloadImages('contact/images/x.png')">
    <div id="ac_background" class="ac_background"> <img class="ac_bgimage" src="../images/Pedini-Integra-Round-Countertop-Kitchen4-500x673.jpg" alt="Background"/>
      <div class="ac_overlay"></div>
      <div class="ac_loading"></div>
    <div id="ac_content" class="ac_content">
      <h1><a href="../index.html">G<sup>M</sup>G<span>&nbsp;&nbsp;&nbsp;STONE</span></a></h1>
      <div class="ac_menu">
          <li> <a href="../images/granite/amazonStar.jpg">CONTACT FORM</a>
            <div class="ac_subitem"> <span class="ac_close"></span>
              <h2>Contact Us<br />
              <div id="formcontent">

    <div id="form">
    <?php if($form_complete === FALSE): ?>
    <form action="contactform.php" method="post" id="comments_form">
        <div class="row">
        <div class="label">Your Name</div><!-- end .label -->
        <div class="input">
        <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''?>
    "/><?php if(in_array('fullname'$validation)): ?><span class="error"><?php echo $error_messages['fullname']; ?></span><?php endif; ?>
        <div class="context">e.g. John Smith or Jane Doe</div><!-- end .context -->
        </div><!-- end .input -->
        </div><!-- end .row -->

        <div class="row">
        <div class="label">Your Email Address</div>
        <p><!-- end .label -->
        <div class="input">
          <input type="text" id="email" class="detail" name="email" value="<?php echo isset($_POST['email'])? $_POST['email'] : ''?>
    "/><?php if(in_array('email'$validation)): ?><span class="error"><?php echo $error_messages['email']; ?></span><?php endif; ?>
        <div class="context">We will not share your email with anyone or spam you with messages either.</div><!-- end .context -->
      </div><!-- end .input -->
        </div><!-- end .row -->

        <div class="row">
        <div class="label">Your Message</div><!-- end .label -->
        <div class="input2">
        <textarea id="comment" name="comment" class="mess"><?php echo isset($_POST['comment'])? $_POST['comment'] : ''?></textarea><?php if(in_array('comment'$validation)): ?><span class="error"><?php echo $error_messages['comment']; ?></span><?php endif; ?>
        </div><!-- end .input -->
        </div><!-- end .row -->

        <div class="submit">
        <input type="submit" id="submit" name="submit" value="Send Message"/>
        </div><!-- end .submit -->
        <?php else: ?>
    <p>Thank you for your Message!</p>
    <script type="text/javascript">
    setTimeout('ourRedirect()', 6000)
    function ourRedirect() {
    <?php endif; ?>

    </div><!-- end form -->
    </div><!-- end formcontent -->
              <!--end subitem--></div>
          <li> <a href="../images/marble/Marble.jpg">MAP & DIRECTIONS </a>
            <div class="ac_subitem"> <span class="ac_close"></span>
              <h2>Marble<br />
                <img src="../images/marble/thumbs/marble.jpg" width="180" height="120" alt="Marble"></h2>
                <li>GMG STONE is Southern California's leading granite fabricator. With their state of the art in-house fabrication facility and skilled technicians, they are able to provide you the best quality product at a reasonable cost.<br />
                  GMG's facility is comprised of many cutting edge computerized machinery - a precise waterjet cutting at 50,000 PSI, a CNC automated fabrication machine, along with the best in the market in-line profile edge machine which transforms a raw cut edge to a polished bullnose edge.<br />
                  Quality Control<br />
                  Every design goes through a rigid quality control inspection by their skilled craftsmen. </li>
                <li><a href="product-gallery.html">Slab Gallery</a></li>
              <!--end subitem--></div>
        <!--end menu--></div>
      <!--end content--></div>
    <div class="bbb"> <a href="" target="_blank"> <img src="../images/cbbb-badge-horz.png" width="149" height="56" alt="BBB"></a>
      <!--end bbb--></div>
    <div class="ac_footer"> <a class="ac_left"><span>Copyright&copy; G<sup>M</sup>G Stone</span> call 1-800-G<sup>M</sup>G-Stone</a> <a href="#"><img src="../images/twitter.png" width="20" height="20" style=" margin-right: 70px;" alt="twitter"></a> <a href="#"><img src="../images/facebook.png" width="20" height="20" alt="facebook"></a>
      <!--end footer--></div>
    The form does validate and sends the e-mail.

    Also the page is located here so you can see what it actually does:

    By the way thanks in advance;



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 09:26 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: