Page 1 of 1

Trouble passing variables in PHP 4.1.2!!!

Posted: Thu Nov 14, 2002 5:56 am
by Skittlewidth
Right, so I got my php script working with PHP 4.2 both with the development php settings and the recommended production settings and then what happens? I discover that the server I'll be running it on only has 4.1.2!
Register Globals is ON
I have removed $_POST['xx'] from my scripts as I believe the correct way in this version is HTTP_POST_VARS[ ]. I've tried this and it doesn't work, but as register globals is on I'd assume I could just pass the variables about as I like.

I'm hoping that this is just a case of my own stupidity but as all my scripts were running near perfectly until 4.1 got involved I'm just a little peeved to have encountered this setback. Anyone had a similar problem?

Submit form

Code: Select all

<input type="submit" name="Submit" value="Submit">
                <input type="reset" name="reset" value="Start Over">
Test page to receive variable

Code: Select all

echo HTTP_POST_VARS&#1111;"Submit"];
(this throws up the following error: Parse error: parse error, expecting `','' or `';'' in submitcheck.php on line 2)
or

Code: Select all

echo $Submit;
Nothing will display at all unless there is something in this variable and there isn't.

Yours confused as ever... :?

Posted: Thu Nov 14, 2002 6:03 am
by twigletmac
$_POST is available in PHP 4.1 - I'd change your scripts back to the way they were before and test them again.

Mac

Posted: Thu Nov 14, 2002 6:15 am
by Skittlewidth
twigletmac wrote:$_POST is available in PHP 4.1 - I'd change your scripts back to the way they were before and test them again.

Mac
Yeah, I tried that, that's how they were when I spotted the problem. The page submitcheck.php just comes up blank as $_POST['submit'] doesn't equal either "Submit" or "Discard".
I couldn't even pass a variable in the simplest of test scripts. I thought I was making good progress in php until yesterday!!! I'll keep trying! :cry:

Posted: Thu Nov 14, 2002 6:23 am
by twigletmac
Try using:

Code: Select all

echo '&lt;pre&gt;';
print_r($_POST);
echo '&lt;/pre&gt;';
at the top of your script to check to see what's being passed in the $_POST array.

Mac

Posted: Thu Nov 14, 2002 6:28 am
by Skittlewidth

Code: Select all

Array
(
)
Nothing!!!

Posted: Thu Nov 14, 2002 6:31 am
by twigletmac
What if you replace $_POST with $HTTP_POST_VARS in that code snippet (just to check but shouldn't make a difference).

Mac

Posted: Thu Nov 14, 2002 6:44 am
by Skittlewidth
twigletmac wrote:What if you replace $_POST with $HTTP_POST_VARS in that code snippet (just to check but shouldn't make a difference).

Mac
No difference. I'm wondering whether its actually something to do with my browser security, as my boss has managed to get $submit to pass but I still can't!

I'll try a few more things and let you know....

Cracked it! Stupid Dreamweaver MX

Posted: Thu Nov 14, 2002 8:04 am
by Skittlewidth

Code: Select all

<form action="submitcheck.php" method="post" enctype="multipart/form-data" name="form1" id="form1" >
That was the problem. Dreamweaver chucked in that "enctype" stuff when I edited my form (having previously hand coded the whole thing) and it messed everything up. PHP4.2 seemed to ignore it but having removed that everything works fine on 4.1 now....

Every come across that before, Twigletmac?

Cheers for your help! :D