Author Topic: PHP form handling, need an explenation of a line  (Read 685 times)

0 Members and 1 Guest are viewing this topic.

Offline DreX

  • Serf
  • *
  • Posts: 42
  • Cookies: -5
    • View Profile
PHP form handling, need an explenation of a line
« on: April 05, 2015, 11:40:52 am »
I just want to know what this lines do:

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

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= '...?
     
« Last Edit: April 05, 2015, 03:24:26 pm by Kulverstukas »

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: PHP form handling, need an explenation of a line
« Reply #1 on: 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.

Offline DreX

  • Serf
  • *
  • Posts: 42
  • Cookies: -5
    • View Profile
Re: PHP form handling, need an explenation of a line
« Reply #2 on: 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.