Hello all!

I have a problem with my code. My server uses php4 and instead of upgrading and dealing with the crappy company I'm using, I decided to learn the basics of php4 and use it for now.

My problem is when I try to transfer information from one page to the next. One page has a link that says this:

<a href="http://www.mysite.com/thispage?fruit=banana&color_name=yellow">

The next page says this:


$fruitcolor=$fruittype. ", " .$colorname;

echo $fruitcolor;

For some reason this doesn't work and I can't seem to figure out why. Any help will be greatly appreciated!!!


Well, there may be several reasons for not getting any result.
First of all, you should have 2 pages - this_page and next_page.

Your link shown on this_page and pointing to the next_page must be

<a href="http://www.mysite.com/nex_tpage.php?fruit=banana&color_name=yellow">

instead of

<a href="http://www.mysite.com/this_page.php?fruit=banana&color_name=yellow">

Next, next_page must have the code for handling the variables sent by get as you correctly did


$fruitcolor=$fruittype. ", " .$colorname;

echo $fruitcolor;

Also - check your php version and note the following:
$HTTP_GET_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_GET_VARS and $_GET are different variables and that PHP handles them as such)
Version PHP4.1.0
Description Introduced $_GET that deprecated $HTTP_GET_VARS.

And last but not least, make sure PHP and Apache are running!!!

Read my post carefylly!

First check if you have written both pages correctly - the send page and the display page.
Then if it is OK, try changing to $_HTTP_GET_VARS instead of $_GET.

Everything was as you said...I'm wondering if I should contact the server owner and see if I can get them to update php. It seems ridiculous to have php4. I do not want to go and change all of this!!! With as many links and information I have, it would take a long time!

Ok, a simple test,

create a file named myfile.php In that file enter the following code.

if (isset($_GET['test_get']) && $_GET['test_get']== 'test')
  echo 'It\'s working using $_GET method!';
  echo '<a href='.$_SERVER['PHP_SELF'].'?test_get=test>Click here to test!</a>';

Then tell me what is the output when you open it with the browser. An error, a link only, or it displays the message, or something else. Please note I will check this tomorrow, as it is 1a.m. here, so i think of going to bed now.

Okay, I put it on a page and uploaded it onto the web to test it out. And nothing showed at all. I am using Webstudio so I'm thinking maybe there's something wrong on their end. I can't get anything figured out :(

<sigh> Hope I can get something figured out. Hopefully I'll hear back from you tomorrow :) Gnight

Hmm...trully awkward. Either there is no php running or there is something really wrong.
Ok, last one. Create one file named e.g. info.php
Into it insert ONLY this line <?php phpinfo();?>
Upload it on the web server and access it via your browser.
You should get full information about PHP loaded on the server, together with web server details, etc...

This article has been dead for over six months. Start a new discussion instead.