0

I am running a PHP page and as soon as I introduce calls like this: $_GET('') then everything goes wrong and I get an error 500.

This code goes not work:

    echo $_GET('username');
    echo $_GET('password');

?>

This code does:

<?php

    phpinfo();

?>
1
  • 1
    $_GET is not a function, it's an array. Back to the beginners manual you.... :) Commented Jun 12, 2011 at 23:10

3 Answers 3

1

The above code has syntax errors - you need to use square brackets.

The web server's error logs will show you those errors if you have access to them.

Sign up to request clarification or add additional context in comments.

Comments

0

Use this:

echo "Username: ".$_GET['username']."<br />Password: ".$_GET['password'];

Since $_GET is a array and not a function, you need to use [square brackets] instead of (normal brackets) to retrieve the data out of a array.

Comments

0

To figure out what the problem is you need to turn on php error reporting. You do this by running this the first thing you do in your php-file:

ini_set('display_errors',1);
error_reporting(E_ALL);

E_ALL means the interpreter will show you errors, warnings and notices. After that, everything will be pretty obvious since php will tell you what went wrong.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.