PDA

View Full Version : Variables not passing...


tylerjca
08-12-2009, 04:57 AM
Hi,

I have recently (today) just switched my XAMPP installation over to a linux system from a WinXP system.
Linux Specs:

Foxconn 661M03-6EL mainboard
Intel P4 3.0Ghz
512MB DDR - will upgrade soon
160GB Western Digital HDD
Fedora 9
I had a lot of problems getting the xampp installation to run smoothly since I'm a linux NEWB but I finally got it! :thumbsup: Unfortunately, now I'm having another problem.

Variable through POST are not getting through whatsoever. I have around 1000 pages (or so...:rolleyes:) of script that won't work now because of this little problem (login scripts and form data mostly)

index.php

<?
if(isset($HTTP_POST_VARS['visitor'])){
echo $HTTP_POST_VARS['visitor'];
}
else{
echo 'No Variable';
}
?>
<hr />
<form method="post" action="/test/index.php">
Enter your name:<br />
<input type="text" name="visitor" value="" size="40" /><br />
<input type="submit" name="sbmt" value="Submit" />
</form>
Whenever I load this page up in my browser (FF) and enter my name "Tyler", click Submit, the page just simply shows no changes. The Variable doesn't exist, which has to be a lie. I don't believe it for a second!:confused:

---------------------------------------------
I also noticed that unless is use isset() for most variable, it will give me a notice that the script will give a warning for any and all variable that are being called, but haven't been declared yet. I found a resolution to it by commenting the following line in php.ini:

;error_reporting = E_ALL | E_STRICT
Would I be correct by saying this turns off ALL (ie E_ALL) warnings and notices? Sometimes I need to be able to see some error or warnings to debug a page.

CFMaBiSmAd
08-12-2009, 05:07 AM
$HTTP_POST_VARS were depreciated 7 years ago, they are turned off by default in php5, and they have been completely removed in php6. You need to change your code to use $_POST. A good programming editor like notepad++ will let you change all the occurrences of $HTTP_POST_VARS to $_POST in all files in a folder(s) you pick.

tylerjca
08-12-2009, 04:53 PM
7 years? wow, that's embarrasing :eek: Anyways, you're right. I changed it to $_POST and it works now.

Thanks for the help! :thumbsup: