Jump to content

v.newbie qu!


willwill100

Recommended Posts

[code] <html>
<?php
if (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??
Link to comment
https://forums.phpfreaks.com/topic/4356-vnewbie-qu/
Share on other sites

[!--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]
Link to comment
https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15139
Share on other sites

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]<?php
if (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
Link to comment
https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15145
Share on other sites

[!--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]<?php
if (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?
Link to comment
https://forums.phpfreaks.com/topic/4356-vnewbie-qu/#findComment-15184
Share on other sites

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.