bandaloop Posted October 8, 2007 Share Posted October 8, 2007 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 https://forums.phpfreaks.com/topic/72314-solved-getting-form-values-without-using-_post/ Share on other sites More sharing options...
trq Posted October 8, 2007 Share Posted October 8, 2007 This is caused by the registr_globals setting being off on your local machine. this is a good thing as it is a major security issue, best to fix your broken code then enable register_globals support. Link to comment https://forums.phpfreaks.com/topic/72314-solved-getting-form-values-without-using-_post/#findComment-364623 Share on other sites More sharing options...
bandaloop Posted October 12, 2007 Author Share Posted October 12, 2007 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 https://forums.phpfreaks.com/topic/72314-solved-getting-form-values-without-using-_post/#findComment-367914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.