kathleenm kathleenm - 2 months ago 7
HTML Question

PHP pass variable through location name

I have inherited this website at my work and it is written in php5, html4, and javascript. The way they pass variables from one page to another is like this:

filename.php?variable=value&secondvariable=secondvalue


So when submitting a form I've seen

<form method="post" name="auth" action="login.php?logon=logon">


and then in
login.php
$logon
is used right away without any use of
$_POST
.

I'm currently upgrading everything and right now I've got it running php7.0. This method of passing variables no longer works. Because it is so hard to phrase what this is doing I haven't been able to find an example of this online. So I don't know why it worked before and I can't figure out why is doesn't work now. Everyone seems to be using SESSION variables or GLOBAL variables but because of the many ways this format is used in the code it is impossible to replace it in every case.

Any information about this would be appreciated.

EDIT:
This is literally the first lines of login.php. $logon is not in "global_vars.php"

<?php
define( 'direct_access', 1 );
include("includes/users.php");
include("includes/global_vars.php");
include("includes/global_functions.php");

if ($logon == "logon"){

Answer

Use PHP's extract() function to import variables into the current symbol table from an array.

extract($_POST);
extract($_GET);

Documentation: http://nl3.php.net/manual/en/function.extract.php

Comments