$_GET()

Problems with the Windows version of XAMPP, questions, comments, and anything related.

$_GET()

Postby gmeyers1 » 08. March 2023 20:06

I am new to XAMPP. I just installed version 8.2.0 on Windows 11. I have existing PHP code (older version) that uses the $_GET() method to get command line args. But is doesn't work with XAMPP. Is this a bug or has this method be dropped?
gmeyers1
 
Posts: 9
Joined: 08. March 2023 19:57
XAMPP version: 8.2.0
Operating System: Windows 11

Re: $_GET()

Postby Altrea » 09. March 2023 03:05

Hi gmeyers1,

gmeyers1 wrote:I have existing PHP code (older version) that uses the $_GET() method to get command line args.

What means "older version"?
What means command line args?
Can you show us the code?

gmeyers1 wrote:But is doesn't work with XAMPP.

What does that mean? Describe as detailed as possible.
What did you expect to happen and what happens instead?
Are there any other information like error messages on the screen or the log files?

[quote="gmeyers1]Is this a bug or has this method be dropped?[/quote]
No. $_GET is one of the most important superglobals in PHP.
If you are not sure whether a feature or function is implemented in a PHP major version, you can always look this up in the manual.
For example for the $_GET superglobal, you see it is implemented in "PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8"

Very likely it is a problem with your code, but without knowing your code it is nearly impossible to provide sufficient help.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: $_GET()

Postby gmeyers1 » 09. March 2023 17:12

Here's a snippet of the code that fails with "$func is undefined". The code is invoked from another section by: titles.php?func=1

========================================
<?php
require_once("utility.php");

$func = $_GET[func];
database_connect();

if ($func == 1)
{
===========================================

utility.php has many methods including database_connect(). However the code fails before executing that command.

My code was written with version 5.4.36.
gmeyers1
 
Posts: 9
Joined: 08. March 2023 19:57
XAMPP version: 8.2.0
Operating System: Windows 11

Re: $_GET()

Postby Nobbie » 12. March 2023 16:43

gmeyers1 wrote:$func = $_GET[func];


This is already an error, the arguments of $_GET must be defined. func is an undefined constant (and you should get a message "undefined constant"). In earlier PHP versions it was accepted and treated as a string, probably in PHP 8.2 this is not accepted anymore. The correct syntax would be:

Code: Select all
$func = $_GET["func"];



So your error might be a follow up error, but we also have to know, what you precisely mean by "is invoked". Can we see the other section also?
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 121 guests