Carrying a value over a refreshed page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joker
    New Member
    • Oct 2006
    • 3

    #1

    Carrying a value over a refreshed page

    HI,
    Can anyone please help me with the following problem that i'm having?
    Basically i have a page, say for instance A.php where i have a list of clients. The names of the clients are links which when cliked take you another page, let us call it B.php. Also, when you clik the link (clinet name) I am passing the name of the client in the URL (B.php?name=joh n). In B.php, i'm using the clinet's name to retreive all its info from the database and display it in a form where it can be edited.
    Now, the problem is once i click the "Update" button, which is suppose to execute the update query and refresh the page (action="<?php echo $_SERVER['PHP_SELF'];?>") i loose the name which was initailly passed in the URL from A.php.
    I have already tried to save it in a session variable, local variable, static variable (which i realize it doesn't apply to strings), i have also made sure that upon refresh of the page (B.php) the local variable or session variable where i have saved the clint's name does not get a new value re-assigned to it. To better understand what i mean by this last line, here is the code:
    [PHP] if($_GET['cName'] != "")
    {
    $client = $_GET['cName'];
    }[/PHP]>

    Thank you,
    Joker
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    If you used sessions correctly it should work. and as per my suggestion best way to do what ever you need is session variables.

    Comment

    Working...