INTRODUCTION

PHP Web Home
Server Setup
nav.php
code.php
Download Tutorial

LESSONS

01 Hello World!
02 Text I/O
03 Arithmetic
04 Date and Time
05 Image Creation
06 Pie Chart
07 Array and Records
08 Delete a Record
09 Shopping
10 Shop Checkout
11 MM Bingo

MORE PHP

PHP Console Apps
PHP and MySQL

02 - Text Input and Output Using PHP

Name

Hello

Homework: Make a form with text input fields where you can enter a full name and address. When you submit the form, the name and address should be displayed.


<!-- Here is the page source code for 02textio.php -->

<?php
  include "code.php";    // Contains the function used to display
                         // the source code of web pages.
			 
  $name = $_POST[name];  // Store data posted to this page into
                         // the $name variable.
?>

<html>
<head>
<title>Text Input and Output Using PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table border="1" cellpadding="4" cellspacing="0">
<tr valign="top">
<td><?php include "nav.php"; ?></td>
<td>
      <h1>02 - Text Input and Output Using PHP</h1>
      <form name="form1" method="post" action="02textio.php">
        <table border="1" cellspacing="0" cellpadding="4">
          <tr> 
            <td><div align="right">Name</div></td>
            <td><input name="name" type="text" id="name" value="<?php echo "$name"; ?>"></td>
          </tr>
          <tr> 
            <td colspan="2">
	      <div align="right">
                <input type="submit" name="Submit" value="Submit">
              </div>
	    </td>
          </tr>
        </table>
      </form>
      
      <?php 
        echo "<h3>Hello $name</h3>\n";
      ?>
      <p><strong><font color="#FF0000">Homework:</font></strong> Make a form 
      with text input fields where you can enter a full name and address. 
      When you submit the form, the name and address should be displayed.</p>
       
      <?php
	dump_page("02textio.php"); 
      ?>
</td>
</tr>
</table>

</body>
</html>