Viper76 Posted July 3, 2006 Share Posted July 3, 2006 I've been offline for about a year, took a break. I am now back and building a website, but I find that a few things seemed to have changed. Here is a small snip of code that does not work. From what I see, form handling has changed. Can someone fill me in?<?PHPIF ($B1) echo "yes";ELSE echo "no";?><form method="POST" action="http://www.the-home-decor-store.com/test.php"><p><input type="submit" value="Submit" name="B1"></p></form>This returns no every time. Its VERY simple, and just by clicking the button, it should return yes. I have found that nothing entered into a form is being passed to the PHP code on the next page. I've tried with both the "post" and "get" methods of creating a form. Someone please help!Sean Link to comment https://forums.phpfreaks.com/topic/13597-what-happened-with-forms-and-php/ Share on other sites More sharing options...
birdie Posted July 3, 2006 Share Posted July 3, 2006 wow ice age :D.[code]<?PHP$B1 = $_POST['B1']; //var = a post varIF ($B1){ // new add on since you last tryed? echo "yes";}ELSE{ echo "no";}?>[/code]Notice the { } to get the var $B1, you need to specify where it comes from as shown above Link to comment https://forums.phpfreaks.com/topic/13597-what-happened-with-forms-and-php/#findComment-52690 Share on other sites More sharing options...
kenrbnsn Posted July 3, 2006 Share Posted July 3, 2006 What you're seeing is the direct result of register_globals being disabled (good) instead of enabled (bad). Please read the section in the on-line PHP manual on [url=http://www.php.net/register_globals]www.php.net/register_globals[/url]You should use $_POST['B1'] instead.Ken Link to comment https://forums.phpfreaks.com/topic/13597-what-happened-with-forms-and-php/#findComment-52691 Share on other sites More sharing options...
Viper76 Posted July 4, 2006 Author Share Posted July 4, 2006 thanks a lot for the help guys! Works great now, and yes, thats new since my last coding project. 8) Link to comment https://forums.phpfreaks.com/topic/13597-what-happened-with-forms-and-php/#findComment-53036 Share on other sites More sharing options...
Recommended Posts