GET form method and accessing its value into a cookie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have a page which generates 'edit' links (used to edit user details). The
code snippet on the 'list_user.php' page is;

---
$print_rows .=    "<tr class=\"stdtablecells\"> \n".
                                "   <td>{$details['name']}</td> \n".
                                "   <td>{$details['mail']}</td> \n".
                                "   <td>{$details['quota']}</td> \n".
                                "   <td><a
href=\"edit_user.php?user={$user_list[$i]['uid'][0]}\">edit</a></td> \n".
                                "</tr> \n";
---

The line in question really is this one;

<a href=\"edit_user.php?user={$user_list[$i]['uid'][0]}\">edit</a></td> \n".

As you can see this creates a link to the 'edit_user.php' page with a GET
parameter generated by a php array.

The 'edit_user.php' page contains this script (before any headers are
generated) which is designed to put the GET value into a cookie;

---
if (! isset($_COOKIE['yhgfluseruid'])) {
    $useruid = $_REQUEST['user'];
    setcookie('yhgfluseruid', $useruid);
}
---

What happens when actually viewing the pages in a browser, is that the url
is generated (seemingly) correctly, for example;
http://localhost/emailadmin/src/edit_user.php?user=paul.bradley@xxxxxxxxxxx

The only problem is the $user variable doesn't seem to read the cookie, or
the cookie doesn't get generated before the rest of the page is generated
and the users details are blank. BUT if I refresh the page, everything is
fine. Also, if I go back to the 'list_user.php' page, and try editing a
different user, although the URL suggests that it's passing the correct
parameters, I end up seeing the details of the previous user?

Help please (sorry for the long description - I am just trying to be
accurate)

Regards
Steve

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux