Trouble passing variables in PHP 4.1.2!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Trouble passing variables in PHP 4.1.2!!!

Post 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... :?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post 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:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

Code: Select all

Array
(
)
Nothing!!!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post 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....
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Cracked it! Stupid Dreamweaver MX

Post 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
Post Reply