Page 1 of 1

Register Gobals and Arrays?

Posted: Thu Feb 24, 2005 6:23 pm
by Mr Tech
This is my code:

Code: Select all

<?php
if ($_POST&#1111;'submit']) &#123;

//check each custom&#1111;] field
foreach($custom as $check) &#123;
if ($check == "") &#123;
$err = "yes";
&#125;
&#125;

if ($err) &#123;
//display error
echo "Error";
&#125; else &#123;
//display thankyou page
echo "All fields entered";
&#125;

&#125; else &#123;
?>
<form action="errorcheck.php" method="post">
<input type="text" name="custom&#1111;1]"><br> 
<input type="text" name="custom&#1111;2]"><br> 
<input type="text" name="custom&#1111;3]"><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
&#125;
?>
My only problem is register globals... I tried adding this:

Code: Select all

foreach($HTTP_GET_VARS&#1111;custom] as $check) &#123;
But I get an error. Can anyone shed some light on this?

Cheers.

Posted: Thu Feb 24, 2005 6:28 pm
by Mr Tech
OK, it looks like I found it... I dont get any errors:

$GLOBALS['custom']

Is that correct/best way to do it?

http://au.php.net/variables.predefined

Posted: Thu Feb 24, 2005 7:20 pm
by feyd
$_POST['custom']

Posted: Thu Feb 24, 2005 7:30 pm
by Mr Tech
LOL, I can't beleive I missed that. Cheers mate. I appreciate the help ;)