|
Posted by Mirco Blitz on 10/02/33 11:07
Hi,
There are multiple Ways of getting that string.
If your PHP-Server has globals=on in php ini you will recive that string in
$selection variable.
If not you recive it in $_GET["selection"]
So I use a function to handle POST and GET Variabels.
function getpost_ifset($test_vars)
{
$return = FALSE;
if (!is_array($test_vars))
{$test_vars = array($test_vars);}
foreach($test_vars as $test_var) {
if (isset($_POST[$test_var])) {
global $$test_var;
$$test_var = $_POST[$test_var];
$return =
TRUE;
} elseif (isset($_GET[$test_var])) {
global $$test_var;
$$test_var = $_GET[$test_var];
$return =
TRUE;
}
}
return $return;
}
If i now want to get a ariable i either POST or GET from an URL i don't care
if POST or GET.
I just do
getpost_ifset("selection");
and then I have a variable called $selection in my code with the given
value.
You could also do something like this.
if(getpos_ifset("selection"))
{
echo "Selection variable is there with value: ".$selection;
}
else
{
echo "No Selection Variable givin in Link";
}
Hope that helps.
Mirco Blitz
-----Ursprüngliche Nachricht-----
Von: Sagaert Johan [mailto:sagaert.j@belgacom.net]
Gesendet: Mittwoch, 2. Februar 2005 11:38
An: php-general@lists.php.net
Betreff: [PHP] newbie question ; calling php script with parrameters from
html
can i use this kind of construction in my html code ?
<a href="test.php?selection=high">Select high</a>
if yes , how do i retrieve the passed string in the php code
Johan
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
Navigation:
[Reply to this message]
|