Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Custom name and value for _POST

    If I have a form:
    1) How can I choose what value goes in which index of the _POST array on the next screen?
    2) How to set my own variables? (incase I need to tell the next screen what I want it to do with the values it gets)

    I.e.
    form:
    Username: ____________
    Password: ____________


    ** Then on the next page **

    _POST[0]="MY OWN CUSTOM VARIABLE HERE?" (set in the previous form)
    _POST[1]="MY OWN CUSTOM VARIABLE HERE?" (set in the previous form)
    _POST[2]=(username)
    _POST[3]=(password)

  • #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    I'm not sure I fully understand.

    You want to have a form and then have the PHP take in the information in each field of the form and do something with the info? Am I close?


    To submit and collect info you would first make a form.

    Code:
    <form action="submit.php">
    <input type="text" name="user">
    <input type="password" name="pass">
    <input type="submit" value="submit">
    </form>
    Then you use PHP to collect the info, and do something with it.

    PHP Code:
    $username $_POST['user'];
    $password $_POST['pass'];

    echo 
    $username;
    echo 
    $password
    Am I way off from what you want?

    Of course there is a lot more too this. You'd want to check if the form actually submitted and several other things.
    Last edited by stevenmw; 10-10-2012 at 09:38 AM.


  •  

    Posting Permissions

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