Register

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 5 of 5
  1. #1
    Junior Member cinq's Avatar
    Join Date
    Jun 2003
    Posts
    18
    Member #
    1971
    Need some help on this.

    Using the attached file as a feedbackform for users to leave comments to my email.

    I have also inserted some javascript for validation , to ensure they enter their name and email as well as fill up the comments field.

    I would like that on page load, the cursor is focused at the name field input box.
    Suppose the visitor then enters his/her name, and clicks submit without entering email address or comments,the javascript alert will cause a dialog box to pop up.

    What i want it that on going back to the feedback page again, the name that was previously entered remains there , and the cursor now lies at the email input box field.

    ( Likewise the scenario if the user forgot to enter any comments , or his/her name )

    *ps, not sure if this belongs here, mods feel free to move it elsewhere if deemed necessary.

    Many thanks for any help in advance.

  2.  

  3. #2
    Junior Member vornn's Avatar
    Join Date
    Jul 2003
    Posts
    15
    Member #
    2150
    Let me get this clear, so I can help you.

    You want a page for feedback, which validates the input and emails it to you? and if the user makes a error, the fields can be populated with the input so the user can make changes?

    If this is the case, I have a script which I'll look for now.

    It basically uses the same page to evaluate the input.

    I'll go looking now.......

  4. #3
    Junior Member vornn's Avatar
    Join Date
    Jul 2003
    Posts
    15
    Member #
    2150
    Found it, this code allows the user to enter data into a form and view the inputted data before it is submitted to the email address.

    It could modified, without too many tears, to do the job you need.


    PHP Code:

    <?php
    $form 
    =& $HTTP_POST_VARS;
    define('FEEDBACK_TO''address@domain.com');
    define('FEEDBACK_SUBJ''Feedback: ');
    switch (
    $form['step'])
    {

        case 
    1:
        default:
    ?>
    <html>
    <head><title>Chapter 7 :: Example 8 :: Feedback Form</title></head>
    <body>

    <h2>Chapter 7 :: Example 8 :: Feedback Form</h2>

    <form action="<?= $PHP_SELF ?>" method="post">

    <input type="hidden" name="step" value="2">
    <b>Name:</b><br>
        <input type="text" name="feedback_name"><br><br>
    <b>Email:</b><br>
        <input type="text" name="feedback_email"><br><br>
    <b>Subject:</b><br>
        <select name="feedback_subj">
        <option selected>Comment</option>
        <option>Complaint</option>
        <option>Suggestion</option>
        </select><br><br>
    <b>Message:</b><br>
        <textarea name="feedback_msg" rows="5" cols="40"></textarea><br><br>
    <input type="submit" value="Continue">

    </form>

    </body>
    </html>
    <?php


        
    break;

        case 
    2:

    ?>
    <html>
    <head><title>Chapter 7 :: Example 8 :: Feedback Form - Review Your Submission</title></head>
    <body>

    <h2>Chapter 7 ::Example 8 :: Feedback Form</h2>
    <h4>Review Your Submission</h4>

    <b>Name:</b><br>
        <?= $form['feedback_name'?><br><br>
    <b>Email</b><br>
        <?= $form['feedback_email'?><br><br>
    <b>Subject:</b><br>
        <?= $form['feedback_subj'?><br><br>
    <b>Message:</b><br>
        <?= $form['feedback_msg'?><br><br>

    <form action="<?= $PHP_SELF ?>" method="post">

    <input type="hidden" name="step" value="3">
    <input type="hidden" name="feedback_name" value="<?= $form['feedback_name'?>">
    <input type="hidden" name="feedback_email" value="<?= $form['feedback_email'?>">
    <input type="hidden" name="feedback_subj" value="<?= $form['feedback_subj'?>">
    <input type="hidden" name="feedback_msg" value="<?= $form['feedback_msg'?>">

    <input type="button" value="Back" onClick="javascript:history.go(-1);">
    <input type="submit" value="Send">

    </form>

    </body>
    </html>
    <?php

        
    break;

        case 
    3:

        
    $feedback_subj FEEDBACK_SUBJ $form['feedback_subj'];
        
    $feedback_body = <<<END
    Name: {$form['feedback_name']}
    Email: 
    {$form['feedback_email']}
    Subject: 
    {$form['feedback_subj']}
    Message: 
    {$form['feedback_msg']}
    END;
        
    mail(FEEDBACK_TO$feedback_subj$feedback_body);

    ?>
    <html>
    <head><title>Chapter 7 :: Example 8 :: Feedback Form - Thank You</title></head>
    <body>
    <h2>Chaptert 7 :: Example 8 :: Feedback Form</h2>
    <h4>Thank You</h4>

    Your feedback has been sent!

    </body>
    </html>
    <?php
        
    break;
    }

    ?>

    Hope it helps...


  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You can also use this auto-validation script for client-side:
    http://www.webdesignforums.net/showt...=&postid=88233

  6. #5
    Junior Member cinq's Avatar
    Join Date
    Jun 2003
    Posts
    18
    Member #
    1971
    Thanks very much for the replies folks, really appreciate it.
    Managed to do what i needed with help from both of you.


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 02:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com