Jump to content

[SOLVED] <input type name="xx"> and $xx


chaiwei

Recommended Posts

Hi all,

 

If I have an

 

(index.php)

<form action="haha.php" action="post">
<input type="submit" name="xx">
</form>

then in

 

(haha.php)

 

i can use the

if($xx){

}

right?

 

But i thought it must be use $_POST['xx'];

Or it is because of the <form action="haha.php">

So can't use the $_POST['xx'] because in haha.php it still got another form?

 

Another situation is if in index.php i got another input type with same name?

 

<form action="haha.php" action="post">
<input type="text" name="xx">
<input type="submit" name="xx">
</form>

So the $xx will refer to which one?

 

EDIT: please use the code tags

Link to comment
Share on other sites

 

But i thought it must be use $_POST['xx'];

Or it is because of the

If you are able to use $xx in haha.php then it means you have register_globals turned on.  Which is a "bad" thing to have on..security wise.  And yes  $_POST['xx'] is the proper way to call it.  There is also $_REQUEST['xx'] but I don't recommend ever using that.

 

Another situation is if in index.php i got another input type with same name?

 

 

 

So the $xx will refer to which one?

it would take the value of the submit button.

Link to comment
Share on other sites

If you are able to use $xx in haha.php then it means you have register_globals turned on.  Which is a "bad" thing to have on..security wise.  And yes  $_POST['xx'] is the proper way to call it.  There is also $_REQUEST['xx'] but I don't recommend ever using that.

 

Hi,

 

Thanks a lot.

But I don't understand what means by register_globals?

Is it inside the phpinfo()?

 

Link to comment
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.