newbie needs help with form processing

Discussion in 'PHP' started by wina, Dec 29, 2007.

  1. #1
    I have a form with many fields on my website that emails the information to me using FormMail.php v5.0. Where can I find a tutorial, or example, on making a simplified web page of the form with the fields filled in for the visitor to print for his records after he presses the submit button?
    Thanks, Wina :)
     
    wina, Dec 29, 2007 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    to print the info after the submit , in the action page just print the info by using GET OR POST (it depend on what you used ..)

    you will need the field name then : $_GET['name-of-the-field']; or POST ...
     
    commandos, Dec 30, 2007 IP
  3. xxKillswitch

    xxKillswitch Peon

    Messages:
    331
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This is an easy task. Let's say your form method is set as POST, and you have an input for their first name, last name and phone number...

    <form id="yourform" method="post" action="sendmail.php">
    <input type="text" name="firstname" id="firstname" />
    <input type="text" name="lastname" id="lastname" />
    <input type="text" name="phone" id="phone" />
    <input type="submit" value="Submit Form" />
    </form>

    On sendmail.php...

    echo $_POST['firstname'];
    echo $_POST['lastname'];
    echo $_POST['phone'];

    This will print off each of the input boxes sent in the form. You will want to make sure you properly sanitize the user input, and sanitize the $_POST you are echoing with htmlspecialchars and all.
     
    xxKillswitch, Dec 30, 2007 IP