Getting URL variable that is a string instead of a number

91 Views Asked by At

I have a PHP script which I can query with a variable.

Here is the URL to do that:

ajax.php?var=3

And here is the bit (inside the PHP file) that grabs that number - it's a phpBB method that works similarly to GET()/POST():

$alink    = $request->variable('var', 1);
echo $alink;

Here's the API section about this 'request' method if interested.

And this is what is outputted on the page when visited:

3

So that works fine. However, when I used a string instead of a number, all it returns is 0 :(

ajax.php?var=Apple

Returns:

0

When visited... so like, why is this and what do I have to do to get my request method to recognised the string? It works fine with a number, so why not a string too?

Thanks :)

0

There are 0 best solutions below