variable vs URL

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

It's probably very easy, but I cannot find my mistake:


echo "<a href=page2.php?vartrans=5342>Clic</a>";


  echo "$vartrans";

When I click on the link on page 1, page 2 appears on the screen but with
the following error message:

Notice: Undefined variable: vartrans in c:\program
files\easyphp1-7\www\page2.php on line 2

What's my mistake?

I use php 4.3.3.

Thank you vm in advance for your help


Re: variable vs URL

Lc wrote:
Quoted text here. Click to load it

You're relying on register_globals being on, and they're off.

Use the superglobal array $_GET instead.

    <?php // page2.php
      echo "";

read all about it at

USENET would be a better place if everybody read:   | to email me: use |   | my name in "To:" |     | header, textonly |                    | no attachments.  |

Re: variable vs URL

Lc schrieb:
Quoted text here. Click to load it
Use better

echo $_REQUEST["vartrans"];

to have both, GET and POST method covered

Site Timeline