Jump to content

Recommended Posts

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........

Link to comment
https://forums.phpfreaks.com/topic/68702-solved-php-formits-not-working/
Share on other sites

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>

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!

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.