Forum Moderators: coopster

Message Too Old, No Replies

i can't send the variable from the html

         

leolotszwai

1:57 am on Feb 6, 2004 (gmt 0)

10+ Year Member



I'm use Apache with php in windows.

As I've written some php, I can't send the variable from the html.
(That means I can't send the value by the "?" follows the ".php"

As the following example,
I type the [127.0.0.1...]

It also showns "no selection!"

<?
if ($a=="first")
{
echo "First is selected!";
}
else
{
echo "no selection!"
}
?>

Are there any settings in Apache or PHP?

isitreal

2:18 am on Feb 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Before you check anything else, make sure you add the semicolon here:
echo "no selection!";

Your error reporting might be turned off, but that will almost always generate a fatal php error if you forget to end a statement with a semicolon.

leolotszwai

2:24 am on Feb 6, 2004 (gmt 0)

10+ Year Member



Sorry for that I've miss typing in this post,
but actually I've put it in the php,
but it doesn't work also~

jatar_k

4:09 am on Feb 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld leolotszwai,

My guess is that register_globals [ca3.php.net] is off.

Therefore you need to access variable in the url using the $_GET [ca3.php.net] superglobal array. So try your code using

<?
if ($_GET['a'] == "first") echo "First is selected!";
else echo "no selection!"
?>

leolotszwai

4:26 am on Feb 6, 2004 (gmt 0)

10+ Year Member



It's work now!
THX~~~