Re: GET and POST variables name
| From: | Tom Rogers | Date: | Sat, 15 May 2004 15:58:23 +0000 |
| Subject: | Re: GET and POST variables name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186315@lists.php.net to get a copy of this message | ||
Hi,
Sunday, May 16, 2004, 1:47:44 AM, you wrote:
DC> i know it could be a stupid problem, but i need a help and i
DC> hope u could be generous with me :).
DC> this is my code, it writes the list of POST and GET variables.
DC> <?
DC> echo "GET:<BR>";
DC> foreach($_GET as $parole)
DC> {
DC> echo "Parola = $parole <br>";
DC> }
DC> echo "<br><br>POST:<BR>";
DC> foreach($_POST as $parole)
DC> {
DC> echo "Parola = $parole <br>";
DC> }
?>>
DC> i want to write also the name of the variable, for example:
DC> if i call my page so ---> index.php?id=2&a=4
DC> it writes
DC> GET:
DC> Parola = 2
DC> Parola = 4
DC> POST:
DC> I want it to write:
DC> GET:
DC> id = 2
DC> a = 4
DC> POST:
DC> how can I do it?
DC> thx for any help.
You need the keys like this:
foreach($_GET as $key=>$parole)
{
echo "$key = $parole <br>";
}
--
regards,
Tom