Replacing $_HTTP_GET_VARS with $_GET
<p>This is a question about setting up variables in an array for a personal memory aid project analogous to the old paper-based flash cards, which I now want to dust off. A PHP programmer at my old work 5 years ago helped write the page - alas I have long since lost contact, and my PHP skills are rudimentary at best.</p>

<h2>Current Code (PHP4)</h2>

<pre><code>    &lt;?php
# Setting up Variables
reset($HTTP_GET_VARS);
while(list($key,$value) = each($HTTP_GET_VARS))
{
    $$key = $value;
}

#set query string, current_id and current_index
$query_string = "sound=$sound&amp;hint=$hint&amp;type=$type";

if(!isset($current_id)) $current_id = "";

if(!isset($current_index)) $current_index = "";

#connect to MySQL
$conn = @mysql_connect( "localhost","xxxx","xxxx" )
  or die( "Sorry - could not connect to MySQL" );

#select the specified database
$rs = @mysql_select_db( "xxx", $conn )
  or die( "Sorry - could not connect to specified Db" );

# create the query to select the records and then …
</code></pre>

<h2>Attempts to find solution</h2>

<p>Initially I tried a simple substitution as recommended elsewhere.  But in the case of this page's code it did not work. I also looked at <a href="http://stackoverflow.com/questions/5814996">Replaced $HTTP_GET_VARS with $_GET, but not working!</a> and it too did not solve the issue (see below attempt)</p>

<h2>Attempted New Code (PHP5)</h2>

<p>Assuming a single table Db, with multiple columns, say 'alpha', 'bravo' and 'charlie', then rows of data in the table cells.  The now depreciated $HTTP_GET_VARS used to work fine:</p>

<pre><code>    &lt;?php
# Setting up Variables
unset($alpha, $bravo, $charlie);
while(list($key,$values) = each($alpha = $_GET['alpha'], $bravo = $_GET['bravo'], $charlie = $_GET['charlie']))
{
    $$key = $value;
}

#set query string, current_id and current_index
$query_string = "sound=$sound&amp;hint=$hint&amp;type=$type";

if(!isset($current_id)) $current_id = "";

if(!isset($current_index)) $current_index = "";

#connect to MySQL
$conn = @mysql_connect( "localhost","xxxx","xxxx" )
  or die( "Sorry - could not connect to MySQL" );

#select the specified database
$rs = @mysql_select_db( "xxx", $conn )
  or die( "Sorry - could not connect to specified Db" );

# create the query to select the records and then...
</code></pre>

<p>The error I get with this code is: Notice: Undefined index: alpha in C:\wamp\www\page2.php on line 4</p>
