user2965943
user2965943

Reputation: 1

Php with undefined data

I've got php files from server, but there is a problem. Those files uses input forms, also getting data via link requests. Surprise is, there is no $_POST or $_GET uses at all. I'm using basic configuration of XAMPP, so it results in a lot of define errors.

I had to add $_POST to make part of it work the way it works on a server, but editing all of php files would be pain.

So the questions is, how can I set php so that it will work with undefined data?

Upvotes: 0

Views: 47

Answers (2)

user2944354
user2944354

Reputation: 1

Try it

extract($_POST, EXTR_SKIP);
extract($_GET, EXTR_SKIP);

Placed them in the starting position of your php file.

eh ...

error_reporting(0);

Upvotes: 0

Quentin
Quentin

Reputation: 944129

Test to see if user input exists before trying to use it.

$foo = "Default value";
if (isset($_GET['foo'])) {
    $foo = $_GET['foo']; 
}

Upvotes: 1

Related Questions