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>";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.