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 3 of 3
  1. #1
    Junior Member Jimmy Jones's Avatar
    Join Date
    Oct 2012
    Location
    Waxahachie, Texas
    Posts
    20
    Member #
    33137
    Liked
    2 times
    I'm wanting to create a confirm info page for a web form. So far my my php script pulls in each form field with something like

    $variable = $_POST['some_form_field'];

    and mails it using mail().

    How would I pull in the variables to a page that creates a string and then passes it on to another script to mail it.

    In other words:

    Thank you $ name for filling out the form. Your email is $email, and your message is: $message.

    Click submit to send the message, or go back to change the message.

    How would I pass the variables created by the form on this intermediate page to a third page?

    I'm trying to learn php right now, but I'm still pretty weak.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    A few different ways of doing this ...

    1) You use AJAX, which is a combination of PHP and javascripting (more specifically JQuery).
    This is a bit more advanced, pertaining to your PHP knowledge. In my opinion the best
    method, but again ... this will require you to find some online scripting examples and demos.

    2) Your "click to submit" message is a form that contains hidden variables.
    Those are the variables you are passing to the next script. The user won't see
    them, but if they view the HTML source, they will see them.

    <form action="process.php" method="post">
    Thank You <?php echo $name;?> for filling out the form.
    <input type="hidden" name="name" value="<?php echo $name;?>">
    <input type="hidden" name="message" value="<?php echo $message;?>">
    <input type="submit" name="submit" value="Click to Submit">
    </form>

    Those hidden variables get passed to the process.php script with $_POST.
    The same way you received them when you displayed the confirmation message.
    If they use their back button to go back and change it, they may retain the first form,
    but otherwise, any refreshes, and they'll lose the values in the form.

    3) Same as #2 except they don't have to go back, you redisplay the form with
    the message filled-in and give them another chance to change it or submit it.
    The PHP value is put into the <textarea>

    <textarea name="message"><?php echo $message;?></textarea>

    4) You save the variables/values in a PHP SESSION or COOKIE. The next
    script reads them from the SESSION or COOKIE and uses them.


  4. #3
    Junior Member Jimmy Jones's Avatar
    Join Date
    Oct 2012
    Location
    Waxahachie, Texas
    Posts
    20
    Member #
    33137
    Liked
    2 times
    #2, #3, and #4 look to be good options for me at the moment. I never thought about using hidden form fields. Leaving the textarea editable is a good idea!

    Thanks!


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