Pages

Tuesday, January 10, 2012

How to create a form in PHP

coding: form.php

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" /><br/>
Age: <input type="text" name="age" /><br/>
      <input type="submit" />
</form>

</body>
</html>

welcome.php

<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>

The output is:




No comments:

Post a Comment