EvilZone

Programming and Scripting => Web Oriented Coding => : DreX April 05, 2015, 11:40:52 AM

: PHP form handling, need an explenation of a line
: DreX April 05, 2015, 11:40:52 AM
I just want to know what this lines do:

:
<form method="post" action="formtest2.php">
<input type="text" name="name2">

http://pastebin.com/TBDjEMt2 (http://pastebin.com/TBDjEMt2)

The way I "understand" this is:
1.st line: the form is set to send the data using POST method to the PHP program formtest2.php -> when I press submit it will realod formtest2.php and it will carry with it anything that has been written in, under $_POST array.

2.nd line: creates an input field. Input type is "text"->meaning it will show what you write in etc...  What you write in is them saved under "name2". If you want to reference it you will call it by "name2" ($_POST[name2]).
      I don't fully understand that "name= ". Is this like $ sign in PHP? Does it always have to be 'name= ' or can it be 'name4444= '...?
     
: Re: PHP form handling, need an explenation of a line
: Kulverstukas April 05, 2015, 03:29:07 PM
"name" is a tag HTML property, so if you change it to "name4444" then HTML will not understand it.
And it's not like a $ sign in PHP. The two cannot even be compared... HTML works in a key-value mode, meaning HTML has defined tags/keys and special words, like any normal programming language does, to which you assign values.
: Re: PHP form handling, need an explenation of a line
: DreX April 05, 2015, 10:26:24 PM
"name" is a tag HTML property, so if you change it to "name4444" then HTML will not understand it.
And it's not like a $ sign in PHP. The two cannot even be compared... HTML works in a key-value mode, meaning HTML has defined tags/keys and special words, like any normal programming language does, to which you assign values.

Thank you for answering.