Skip to content
Advertisement

Why doesn’t this get function receive the variable car?

*quick_searches.php

This code items that similar to a search done on a previous page. Then is supposed to save the specific brand listed to car.

JavaScript

test.php

This section of code is supposed to get car = ‘.$row[‘brand’].’ from quick_searches.php and display it.

JavaScript

Advertisement

Answer

So your URL has spaces around the parameter values – these have been URL Encoded to %20.

If you url_decode() the URL you’ll see:

JavaScript

If you can update the URL to not have those spaces that would be preferable. Alternatively try requesting $_GET['car '] rather than $_GET['car'] and be sure to trim() your value returned to take the space away from the beginning.

Generally much preferable to not have spaces in a URL if you don’t need them though and have control to change things.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement