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
https://forums.phpfreaks.com/topic/133306-solved-and-xx/
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
https://forums.phpfreaks.com/topic/133306-solved-and-xx/#findComment-693285
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
https://forums.phpfreaks.com/topic/133306-solved-and-xx/#findComment-693287
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.