Re: url function
| From: | Web Admin | Date: | Tue, 29 Aug 2000 15:25:40 +0000 |
| Subject: | Re: url function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14151@lists.php.net to get a copy of this message | ||
Yo Bas,
one way is to use foreach to print all the variables, i dont
know if i get you right or not, if you want to print the value
of word1, just use
<?php print $word1; ?>
if you want to parse the URL and extract all the variables, use
this code:
$a = split ('&', $querystring);
$i = 0;
while ($i < count ($a)) {
$b = split ('=', $a [$i]);
echo 'Value for parameter ', htmlspecialchars (urldecode ($b [0])),
' is ', htmlspecialchars (urldecode ($b [1])), "<BR>";
$i++;
}
I hope it works,
Ahmad Anvari
----- Original Message -----
From: "Bas Jochems" <bas@webdisplay.nl>
To: <php-general@lists.php.net>
Sent: Tuesday, August 29, 2000 7:43 PM
Subject: [PHP] url function
> Hello,
>
> Suppose i have:
>
> http://www.sit.com/index.php?word1=bike&word2=house
>
> Which function can i use to get all variables out of a URL?
>
> the variables like "word1" and "word2" are not the same everytime
> so i wanna know all variables and their values in the current URL.
>
> any help would be really appreciated
>
> regards
>
> Bas
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>