Jump to content

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

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.