One more question on post and get

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 3
Joined: Fri Jul 04, 2003 8:30 pm
Location: michigan

One more question on post and get

Postby chartxyz » Fri Jul 04, 2003 8:53 pm

The article by redcircle is very helpful since I am having the exact problem
with post and get after I installed redhat 8.0

Before this, I had redhat 7.2 and php3. All my php code worked fine. Now variables from html forms in my code cannot be passed onto my php script which served as cgi.

My question is, if I do not change my old code which is pretty large
what is the easy fix on that?

I am new to php. Sorry I have to ask this question again.

New php-forum User
New php-forum User
Posts: 6
Joined: Sat Jul 05, 2003 12:57 am

Postby daveyboy » Sat Jul 05, 2003 1:03 am

It sounds like you've fallen into the usual trap for post php 4.2.

From this point on the php developers (quite rightly) decided to not make post, and get variables global.

any of these variables can be referenced from the $_POST and $_GET arrays.

Alternatively you can just change your php.ini configuration file to set register_globals to "On":

register_globals = On

Or uncomment it if it's already there, be warned however that this is a security risk if you do not thoroughly test your code.

Hope that helps :D

User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Redcircle » Mon Jul 07, 2003 9:07 am

What you could do at the top of the php files any variables that are passed in you can define like

Code: Select all

$username = $_POST['username'];
$submit = $_POST['submit'];

and so on.

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest