Reputation: 221
Here's my PHP:
<?php
$userTimeZone=$_GET('timezone');
//$userTimeZone=$_POST('timezone');
$date=gmdate();
$date=date_create($date, new DateTimeZone("GMT"))
->setTimezone(new DateTimeZone($userTimeZone))->format("U");
echo $date;
?>
I get error 500 when I use $_GET
or $_POST
but otherwise (using hard coded timezone) it's working fine. It isn't the problem with the GET or POST value as the problem persists if I use hard coded timezone without removing GET or POST commands. Need help. Thanks!
Upvotes: 0
Views: 64
Reputation: 7157
Follow: http://php.net/manual/en/reserved.variables.get.php
$_GET An associative array of variables passed to the current script via the URL parameters
You're using:
$_GET('timezone');
is a not the right form to access an array. It should be:
$_GET['timezone'];
Upvotes: 1