SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to retrieve the value on the previous page.

    Hi,

    Can anyone tell me how to get the same value of the input data.

    Example:

    If i have insert a data but there is a validation error,so if i click back on the page the data that has been submit must not be erase..
    How to do this?
    i have tried to user this code.

    <input type='submit' value="$_POST['somedata']" name='Username'/>

    something like this but it print out the exact value like $_POST['somedata'] or $user.

    Thanks for the help.

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Location
    Largo
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    instead of $_POST use $_REQUEST

    $_REQUEST['somedata']

    request gets $_GET,$_POST,$_SERVER etc

    and although not 100% certain I am pretty sure it can be done with out registering globals

  3. #3
    SitePoint Zealot Zurev's Avatar
    Join Date
    Feb 2009
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using $_POST is fine to my knowledge, and that should be working except the first time they view they'll get an undefined index most likely. So make the value of the form:
    PHP Code:
    <input type='submit' value="<?php if(isset($_POST['somedata'])) echo $_POST['somedata']; ?>" name='Username'/>

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah.Thanks..po..


Bookmarks

Posting Permissions

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