sushank Posted September 10, 2007 Share Posted September 10, 2007 help me.....its not working...... i have seen this code in wrox professional php programming....and try to run it...... <HTML> <FORM> Please type your name here:<BR> <INPUT TYPE=TEXT NAME=username><BR><BR> <INPUT TYPE=SUBMIT VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php echo ($username); ?> </HTML> when we enter the name and press the submit button its should print wat ever u have entered...but its not working...can any please tell me wats the problem....and i am using wamp 1.7.2.........waiting for ur replies........ Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/ Share on other sites More sharing options...
MadTechie Posted September 10, 2007 Share Posted September 10, 2007 try this <HTML> <FORM> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php echo $username; ?> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345365 Share on other sites More sharing options...
sushank Posted September 10, 2007 Author Share Posted September 10, 2007 i have tried but not working.....is there any problem wid version of php ...should i have to try that wid old version of php Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345369 Share on other sites More sharing options...
MadTechie Posted September 10, 2007 Share Posted September 10, 2007 OK well global register is off (thats good), so your need to tell the form and the php which method to use e.g. <HTML> <FORM method="post"> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php echo $_POST['username']; ?> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345379 Share on other sites More sharing options...
sushank Posted September 10, 2007 Author Share Posted September 10, 2007 thanks dude....its working............ Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345387 Share on other sites More sharing options...
sushank Posted September 10, 2007 Author Share Posted September 10, 2007 btw...what is the global register.....i am very new to php......... Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345388 Share on other sites More sharing options...
MadTechie Posted September 10, 2007 Share Posted September 10, 2007 See here register_globals I'll stress that running PHP with register globals turned on, though convenient, opens unnecessary security risks. Example <HTML> <FORM> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php //$admin = false; //without this line theirs a security hole!!!!! echo $username; if($username == "ADMIN") { $admin = true; } //....................other code if($admin) { echo "<br />Welcome Admin"; } ?> </HTML> now if i used the name as ADMIN i am the administartor anything else an i am not.. BUT if i load the page like this TEST.php?admin=1 then $admin will be 1 (aka true) thus anyuser could be the admin, this can be corrected by setting $admin to false at the start of the script but still it could be missed! Quote Link to comment https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/#findComment-345394 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.