Php Tutorial – CHAPTER 7: Working with forms
One of the most interesting things that you can use with in PHP is
forms. Because using them you can make your pages more dynamic and
interactive. I would like show some few examples that will help you to
combine the HTML with the amazing features of PHP. In this chapter you
will learn how to use the variables $_GET and $_POST. Now we are going
to create two files. The first one will be named INDEX.htm and the
second one will be named Notice.php.
<strong><Html> <head> <title> PAGE OF THE CHAPTER 7 </title> </head> <html> <body> <form action="notice.php" method="post"> Last_name: <input type="text" name="last_name" /> Age: <input type="text" name="age" /> <input type="submit" /></span> </form> </body> </html></strong>
This file should be saved INDEX.htm. Then write the following PHP
file.
<strong> <Html> <head> <title> PAGE OF THE CHAPTER 7 </title> </head> <html> <body> Welcome <span style="color: #ff0000;"><?php echo $_POST["last_name"]; ?></span>.<br /> You are <span style="color: #ff0000;"><?php echo $_POST["age"]; ?></span> years old. </body> </html></strong> <strong></strong>
Now this file should be saved as notice.php. When you run the first
HTML file you can type the last name and the age and the result should
be similar to this: “Welcome Suero. You are 20 years old”
