Core PHP

A Simple Form

This PHP example program demonstrates how to write and handle a simple form.

SimpleForm.html

<!DOCTYPE>
<html>
  <body>

<form action="Simple.php" method="post">
Name: <input type="text" name="name"><br /><br />
E-mail: <input type="text" name="email"><br /><br />
<input type="submit">
</form>

  </body>
</html>
 

Simple.php

<!DOCTYPE>
<html>
<body>

Welcome <?php echo htmlspecialchars($_POST["name"]); ?><br />
Your email address is: <?php echo htmlspecialchars($_POST["email"]); ?>

</body>
</html>
 

Output

 
 

© 2007–2024 XoaX.net LLC. All rights reserved.