Extract command error: first parameter shouyld be an array

Hi
I maintain my own web site but it was designed and coded by someone else. I blunder my way around with cut and past and have successfully managed to maintain it for several years. The URL is www.singforjoy.org.nz. One page, registrationnew.php is for registration for workshops (code included below). It has a line
extract($HTTP_POST_VARS,EXTR_SKIP);
Some time ago, in preview mode I started getting this error:
Warning: extract() expects parameter 1 to be array, null given in C:\Users\maxnew\Documents\aSingForJoy\WebPHP\registrationnew.php on line 53 (the extract line). However, it still worked fine online and has been until a couple of weeks ago. Yesterday I edited the page to add a couple of workshops and posted it online. When I tested it, I found it doesn’t work. I can fill out the form and hit Send email now, but nothing happens.
I have searched for $HTTP_POST_VARS in the page and in the included header and footer pages but can’t find any trace of the array or where it is defined. Whether this is the problem or not I don’t know and I have no idea what the contents of the array would be.
I am using Rapid PHP 2014, version 12.2 as an editor and my host is running php 5.3. I can modify this to 5.4,5 or 6.

Thanks in advance if you can help with this.
Max Maxwell

REGISTRATIONNEW.PHP

[code]<?
$heading = “Workshop Registration”;
include (“includes/header.php”);?>

  <?

// header info
extract($HTTP_POST_VARS,EXTR_SKIP);
if (isset($sendemail)) {
$headers1 = "From: ".$visitoremail. “\r\n”;

$theMessage = “Name : “.$visitorname.”\n\n”;
$theMessage = $theMessage . “Visitor email address : “.$visitoremail.”\n\n”;
$theMessage = $theMessage . “Visitor confirm email : “.$visitorphone.”\n\n”;
$theMessage = $theMessage . “No. people : “.$nopeople.”\n\n”;
$theMessage = $theMessage . “Please register me for : “.”\n\n” ;

if (isset($wk1)){$theMessage = $theMessage .“SingForJoy, Term 1”."\n\n";}
if (isset($wk2)){$theMessage = $theMessage .“UkeNSing, Term 1”."\n\n";}
if (isset($wk3)){ $theMessage = $theMessage . “Uke Beginner, Mt Eden Feb” ."\n\n";}
if (isset($wk4)){$theMessage = $theMessage .“Uke Fasttrack, Mt Eden, Mar”."\n\n";}
if (isset($wk5)){$theMessage = $theMessage . “Taize, Jan”."\n\n";}
if (isset($wk6)){$theMessage = $theMessage .“Taize, Feb”."\n\n";}
if (isset($wk7)){$theMessage = $theMessage .“Taize, Mar”."\n\n";}
if (isset($wk8)){$theMessage = $theMessage .“Uke Beg, home”."\n\n";}
if (isset($wk9)){$theMessage = $theMessage .“Katikati Paul”."\n\n";}
if (isset($wk10)){$theMessage = $theMessage .“Katikati Max”."\n\n";}
if (isset($wk11)){$theMessage = $theMessage .“Nuking, Chch”."\n\n";}
if (isset($wk12)){$theMessage = $theMessage . “Taize, Kaiwaka”."\n\n";}
if (isset($pp)){$theMessage = $theMessage .“Prepay”."\n\n";}
if (isset($door)){$theMessage = $theMessage .“Pay at the door”."\n\n";}
if (isset($free)){$theMessage = $theMessage .“Free”."\n\n";}
$theMessage = $theMessage . “Message : “.$message.”\n\n”;

mail("[email protected]", "Workshop registration", $theMessage,$headers1);

}

?> <? if (isset($sendemail)) {?>

Thank you, your registration has been sent
<?}?>

<form action="registrationnew.php" name="formcompetition" method="post" onsubmit="return validate(this);">


<tr>
  <td align="right" nowrap class="bg01">Your <b>Name</b>: </td><td class="bg01"><INPUT TYPE="Text" NAME="visitorname" class="formtext"><font size='3' color='000000'>*</font></td>
</tr>
<tr>
  <td align="right" nowrap class="bg01">Your <b>Email address</b>: </td><td class="bg01"><INPUT TYPE="Text" NAME="visitoremail" class="formtext"><font size='3' color='000000'>*</font></td>
</tr>
<tr>
  <td align="right" nowrap class="bg01">Your <b>Email address again</b>: </td><td class="bg01"><INPUT TYPE="Text" NAME="visitorphone" class="formtext"></td>
</tr>




I have managed to break this page somehow, so if you wish to register for the Katikati uke (or other) workshops
please email me: [email protected] with your name, which workshop(s) and no. of people attending. Prepay a/c number is below



	<td align="right" valign="top" class="bg01" rowspan=10>I would like to register for </td>
	<td class="bg01"><input type="checkbox" name="wk1" value="1"> SingForJoy Mt Eden<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term 1. Starts Jan 28</td>
</tr>
<tr>
	<td class="bg01"><input type="checkbox" name="wk2" value="1">Uke N Sing group Mt Eden<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term 1 Starts Jan 28</td>
<tr>
	<td class="bg01"><input type="checkbox" name="wk3" value="1">Uke Beginner - 5 weeks, evening<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mt Eden, Starts Feb 3</td>
</tr>
 <tr>
	<td class="bg01"><input type="checkbox" name="wk8" value="1">Uke Beginner - 5 weeks, daytime<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Waterview, Starts Feb 3</td>
</tr>
<tr>
    <td class="bg01"><input type="checkbox" name="wk4" value="1">Uke FastTrack - 4 weeks<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mt Eden, Starts Mar 10</td>
</tr>
<tr>
    <td class="bg01"><input type="checkbox" name="wk9" value="1">Katikati Uke March 14<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Paul (morning)</td>
</tr>
<tr>
    <td class="bg01"><input type="checkbox" name="wk10" value="1">Katikati Uke March 14<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Max (afternoon)</td>
</tr>
</tr>
	<td class="bg01"><input type="checkbox" name="wk5" value="1"> Taize evening, Pt Chev <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jan 30. &nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
    <tr>
	<td class="bg01"><input type="checkbox" name="wk6" value="1"> Taize evening, Pt Chev <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feb 27. &nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
	<td class="bg01"><input type="checkbox" name="wk7" value="1"> Taize evening, Pt Chev <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mar 27. &nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
  <td align="right" nowrap class="bg01">Number of people attending </td><td class="bg01"><INPUT TYPE="Text" NAME="nopeople" class="formtext"></td>
</tr>

<tr>
	<td align="right" valign="top" class="bg01" rowspan=2><b>I intend to</b> <br />
    <font color="#FF00FF">(Prepay to account 12 3020 0414108 00 specifying workshop
		and your name)</font></td>
	<td class="bg01"><input type="checkbox" name="pp" value="1"> Prepay</td>
 </tr>
 <tr>
	<td class="bg01"><input type="checkbox" name="door" value="1"> Pay at the door</td><td>.</td>
</tr>

<tr>
<tr>
  <td valign="top" class="bg01">Anti Spam: 2 + 3 = (please put answer in box)</td><td class="bg01"><INPUT TYPE="Text" NAME="sum" class="formtext"><font size='3' color='000000'>*</font></td>
</tr>
<td class="bg01">&nbsp;</td><td class="bg01">&nbsp;<br><INPUT TYPE="Submit" NAME="sendemail" class="button" VALUE="   send email now   "></td>
Comment:
<?include ("includes/footer.php");?>

END OF REGISTRATIONNEW.PHP

[/code]

INCLUDES/HEADER.PHP

[code]

Max Maxwell Sing For Joy singing workshops and Community Choir



<?include("includes/menu.php");?>

<?=$heading?>

[/code]

Well, first, you should not post any email addresses in your posts as you did here in your sendmail
section. there are many hacker robots out there that sit and scan forums for emails to add to their
spam lists…

The code you showed us is Javascript. The line extract($HTTP_POST_VARS,EXTR_SKIP); is PHP.
To understand why it is throwing an error, you need to find where the PHP FUNCTION “extract” is
defined. Most likely at the top of that page or inside an INCLUDED page of functions.

Try to find that function “extract” and show us that function. The error is saying that one or both of the
arguments sent in the calling line was not an array and it was expect to be one. To find out what is in
each can be handled this way: (Replace the calling line extract($HTTP_POST_VARS,EXTR_SKIP); with:)
[php]
echo “First arg:”;
print_r($HTTP_POST_VARS);
echo “
Second arg:
”;
print_r(EXTR_SKIP);
die(“
done!”);
extract($HTTP_POST_VARS,EXTR_SKIP);
[/php]
This will show you what is beinng sent as data and you can see which is in error. The extract will not
happen and the page will die, but you can see what is attempting to be passed to the extract function.
Just do this for a moment and see what it shows and then delete that extra code or comment it out.
It’s just a temp so you can know what is being sent.

Of course, you need to locate where the PHP function ’ extract ’ is and post that and we can help further.

I know this doesn’t solve it, but steers you in the direction, I hope. Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service