Results 1 to 5 of 5

Thread: Quick question about the contact form

  1. #1

    Quick question about the contact form

    Hey guys,

    I have a simple question about the contact form on the kirupa tutorial guide. All I want to know is once the person clicked on the send button I want the user to get a message saying your form has been sent but i want the page to go back to my intranet after. How can I make that happen?

    Cheers and thank you.

  2. #2
    you'll probaply want something like this in javascript:
    // put this in between the header tags
    <STYLE TYPE="text/css">
    <!--
    .message_screen
    {
    z-index = 100;

    }
    -->
    </STYLE>

    put a div in you're html
    with class='message_screen' id='message_screen'

    put this in script tags

    var obj = getElementById( 'message_screen');
    obj.innerHTML = "<TABLE (putting some color here will overlay the background)>
    <TR>
    <TD> &nbsp;</TD>
    <TD> &nbsp;</TD>
    <TD> &nbsp;</TD>
    </TR>
    <TR>
    <TD> &nbsp;</TD>
    <TD> buid you're htmlcode for the screen here in this way it whil always be centered</TD>
    <TD> &nbsp;</TD>
    </TR>
    <TR>
    <TD> &nbsp;</TD>
    <TD> &nbsp;</TD>
    <TD> &nbsp;</TD>
    </TR>
    </TABLE>"


    setTimeOut("redirectFunc()", 1000);

    function redirectFunc()
    {
    location="you're page where you want to redirect to";
    }

    oke that should do the job....
    Last edited by borrob; February 9th, 2007 at 06:06 PM.

  3. #3
    Thank you for you answer, I really appreciate. I'll try it and give you a comeback on that.

    Thank you again.

  4. #4
    Is there any way to accomplish the same stuff that you did but in php. I'll show you the code I have right now.

    PHP Code:
    <?php
    if(isset($_POST['submit'])) {
      if(isset(
    $_POST['name'])) {
        
    $to "xxx";
        
    $headers "From: xxx";
        
    $subject "Intranet";
        
    $name_field $_POST['name'];
        
    $message $_POST['message'];
        
    $option $_POST['type'];
     
        
    $body "From: $name_field\n\n$option\n\nMessage:\n$message";
     
        echo 
    "Votre courriel à été envoyer à $to!";
        
    mail($to$subject$body$headers);
      }
    }
    ?>
    I just want to know if there is a way to redirect to my main page after the mail() event??

    and this is a part of my html

    Code:
     
    <div class="content">
      <form method="POST" action="scripts/mailer.php">
        <div class="tborder" style="margin-bottom: 2px; background-color: #E5E5E8;">
          <div class="catbg" style="padding: 3px 6px 3px 6px; text-align: justify;">
            Pour soumettre une id&eacute;e, question ou un commentaire, veuillez remplir le formulaire ci-dessous. Nous vous répondrons dans les plus brefs d&eacute;lais.
          </div>
          <table width="99%">
            <tr>
              <td>
                <br />
                Nom:<br />
                <input type="text" name="name" size="30">
              </td>
            </tr>
            <tr>
              <td>
                </p>
                <select name="type">
                  <option value="commentaire">Commentaire</option><br />
                  <option value="idee">Id&eacute;e</option><br />
                  <option value="suggestion">Suggestion</option><br />
                </select>
              </td>
            </tr>
            <tr>
              <td>
                <br />
                <textarea rows="9" name="message" cols="60"></textarea>
              </td>
            </tr>
            <tr>
              <td>
                <input type="submit" value="Envoyer" name="submit">
              </td>
            </tr>
          </table>
        </div>
      </form>
    </div>
    Thank you again.
    Last edited by AllSystemGo; February 13th, 2007 at 10:37 AM.

  5. #5
    i wrote an example for you
    redirect to this page after you're form and
    you'll see what happens....
    <html>
    <head>
    <title></title>
    <meta name="author" content="rob">
    <meta name="generator" content="Ulli Meybohms HTML EDITOR">
    <STYLE TYPE="text/css">
    <!--
    .message_screen
    {
    z-index:100;
    }
    -->
    </STYLE>
    <script language='JavaScript'>
    <!--
    // write the call to you're javascript function

    window.onload = function()
    {
    var message_obj = document.getElementById( 'message_screen' );
    message_obj.innerHTML = redirect_html;
    setTimeout('redirectFunc()',2000);
    }
    function redirectFunc()
    {
    location="to_page.php";
    }

    var redirect_html = "<TABLE bgcolor='#FF0000' BORDER='0' width='100%' height='100%'><tr><td><table width='100%' height='100%'><tr><td align='center' valign='middle'>i Am redirecting you</td></tr></table></td></tr></table>";


    //-->
    </script>

    </head>
    <body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
    <div id="message_screen" class="message_screen"> </div>
    this is you're mail page.........
    </body>
    <?php
    /*
    You do you're stuf here
    mail what you want
    be very busy
    */
    sleep(2);
    ?>
    </html>

    i would like to advise you to use ajax if you can because now the page will be visible after you did you're php stuff but this works....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012