willwill100 Posted March 7, 2006 Share Posted March 7, 2006 [code] <html><?phpif (isset($comf)){echo("THIS THING WORKS!!");}else{?><form action="test.php" method="get">User:<input type="text" name="uname"><br>Password:<input type="password" name="upass"><br><input type="submit" name="comf" value="Submit"></form><?php}?></html>[/code]y is "this thing works" not outputted?? Quote Link to comment https://forums.phpfreaks.com/topic/4356-vnewbie-qu/ Share on other sites More sharing options...
XenoPhage Posted March 7, 2006 Share Posted March 7, 2006 [!--quoteo(post=352590:date=Mar 7 2006, 02:57 PM:name=WillWill)--][div class=\'quotetop\']QUOTE(WillWill @ Mar 7 2006, 02:57 PM) [snapback]352590[/snapback][/div][div class=\'quotemain\'][!--quotec--]y is "this thing works" not outputted??[/quote]Presumably you mean *after* you submit the form. This is because register_globals is hopefully turned off, and $comf isn't defined anywhere. Try this :[code]if (isset($_REQUEST['comf'])) { print "THIS THING WORKS";} else {?><form action="test.php" method="get">User:<input type="text" name="uname"><br>Password:<input type="password" name="upass"><br><input type="submit" name="comf" value="Submit"></form><?php}?></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15139 Share on other sites More sharing options...
kenrbnsn Posted March 7, 2006 Share Posted March 7, 2006 You really should use the superglobal array that matches the method in your form, $_GET if the method is "get", $_POST for "post". If you use the $_REQUEST array, your script could be comprimised.[code]<?phpif (isset($_GET['comf'])) { print "THIS THING WORKS";} else {?><form action="test.php" method="get">User:<input type="text" name="uname"><br>Password:<input type="password" name="upass"><br><input type="submit" name="comf" value="Submit"></form><?php}?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15145 Share on other sites More sharing options...
willwill100 Posted March 7, 2006 Author Share Posted March 7, 2006 [!--quoteo(post=352599:date=Mar 7 2006, 08:19 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 7 2006, 08:19 PM) [snapback]352599[/snapback][/div][div class=\'quotemain\'][!--quotec--]You really should use the superglobal array that matches the method in your form, $_GET if the method is "get", $_POST for "post". If you use the $_REQUEST array, your script could be comprimised.[code]<?phpif (isset($_GET['comf'])) { print "THIS THING WORKS";} else {?><form action="test.php" method="get">User:<input type="text" name="uname"><br>Password:<input type="password" name="upass"><br><input type="submit" name="comf" value="Submit"></form><?php}?>[/code]Ken[/quote]Thanks for the help guys, sorry for the double post can a mod delete the duplicate? Quote Link to comment https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.