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 9 of 9
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Matewan, WV
    Posts
    201
    Thanks
    0
    Thanked 1 Time in 1 Post

    Implanting Vars.

    How would I take a form field var. which was posted by a user and implant it into a page?

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Location
    California
    Posts
    925
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use the _POST to get the var into a PHP variable...


    Jason

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you have a form field that look like this :

    <input type=text name=username>

    Then, after the form has been submitted you can access the value submitted like this :

    The data you submitted is <?php echo $_POST['username'] ?>

    or <?php print "The data you submitted is {$_POST['username']}" ?>

    Note that you have to use {} when accessing the variable inside quotes.

  • #4
    Regular Coder
    Join Date
    Apr 2003
    Location
    Matewan, WV
    Posts
    201
    Thanks
    0
    Thanked 1 Time in 1 Post
    thank u both very much but one more thing...i need to know how to add cookies to remember the info posted..

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Never worked with cookies, but you might wanna check here http://www.php.net/setcookie

  • #6
    Regular Coder
    Join Date
    Apr 2003
    Location
    Matewan, WV
    Posts
    201
    Thanks
    0
    Thanked 1 Time in 1 Post
    ty..very fast response

  • #7
    Regular Coder
    Join Date
    Apr 2003
    Location
    Matewan, WV
    Posts
    201
    Thanks
    0
    Thanked 1 Time in 1 Post
    ne other suggestions

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts

    for the cookie

    A major problem I had with setcookie function was that I didn't realize it was supposed to be on the VERY top of the page, even
    spaces count. Make sure that is the case for you otherwise it will generate errors.

    Duniyadnd

  • #9
    Regular Coder
    Join Date
    Apr 2003
    Location
    Matewan, WV
    Posts
    201
    Thanks
    0
    Thanked 1 Time in 1 Post
    thanks..thats probably my problem


  •  

    Posting Permissions

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