Core PHP

The Simplest Form

This PHP example program demonstrates how to write and handle the simplest possible form.

SimplestForm.html

<!DOCTYPE>
<html>
<body>

<form action="Simplest.php" method="post">
Name: <input type="text" name="sNameKey">
<input type="submit">
</form>

</body>
</html>
 

Simplest.php

<!DOCTYPE>
<html>
<body>

<?php echo "Your name is " . htmlspecialchars($_POST["sNameKey"]); ?>

</body>
</html>
 

Output

 
 

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