Processing PHP PHP forms; variable

I am studying a newbie and trying to understand how html forms and php processing work.

This pair of examples happened:

HTML FORM:

<html>
<body>

  <form action="hello-web.php" method="GET">
  <label>Name:</label>
  <input type="text" name="yourName" size="24">
  <input type="submit">
  </form>

</body>
</html>

PHP PROCESSOR:

<?php
$fname = $_GET["yourName"];

echo "Hello $fname!";
?>

EXIT SHOULD BE: Hi Entered / Example Name!

Question: When I try to change the variable "yourName" (on BOTH HTML and PHP files), for example, "typeName" , the name entered in the form does not appear.

In other words, the output becomes: Hello!

Is "yourName" a standard php or html variable? Could this be changed to what you want?

Better yet, how exactly are the form data handled?


, ( , , , :

HTML ( - typeName):

<html>
<body>

  <form action="hello-web.php" method="GET">
  <label>Name:</label>
  <input type="text" name="typeName" size="24">
  <input type="submit">
  </form>

</body>
</html>

PHP PRCESSOR ( - typeName):

<html>
<body>
<?php
$fname = $_GET["typeName"];

echo "Hello $fname!";
?>

</body>
</html> 
+3
2

, , . GET, , :

var_dump( $_GET );

, PHP script.

Array
(
  [YourName] => Jonathan
)

, , , $_GET ( POST, $_POST).

, :

echo $_GET["yourName"]; // nothing output to the screen

, , , " ":

echo $_GET["YourName"]; // Jonathan
+1

$_GET["yourName"]; , . php superglobal http://us3.php.net/manual/en/reserved.variables.get.php

, html, . $_GET["yourName"];

0

All Articles