Jump to content

[SOLVED] Getting form values without using $_POST


bandaloop

Recommended Posts

Hi all,

I just started supporting my first php app, and am attempting to set up a development copy locally on my pc. In some places in the application, forms are submitted and the values retrieved w/o the use of $_POST['inputname'] (the form method is post.)

 

This works on the production site, but not locally. I've made sure the php.ini is the same, and I can't find any other hints as to why this might be. Using PHP5 w/ Apache 2.

 

I don't want to have to modify a bunch of working code I'm not yet familiar with to get it to work on my pc, thought maybe this would be a no-brainer for the experts. Sample code below.

 

Any ideas appreciated, thanks!

 

 

//No declarations or includes at the top

//validate form is submitted
if ($submit){
     if ($user != "" && $pass != ""){
          //Validate user
     }
}

//create the form
echo "<form NAME='mainForm' ACTION='<?PHP ECHO $PHP_SELF;?>' METHOD='post'>";
	echo "<table>";
	echo "<tr><td>User name:</td><td> <input name='user'></td></tr>";
	echo "<tr><td>Password:</td><td> <input type='password' name='pass'></td></tr>";
	echo "<tr><td></td><td><br><input type='submit' name='submit' value='Login'></td></tr>";
	echo "</table>";
echo "</form>";

I figured out (eventually) why this was happening.

 

registr_globals was set to off on the remote site and my machine. However, there was an .htaccess file (another topic new to me) that was overriding the globals setting. I had to set this up to work in the Apache config.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.