3D Gallery with Great Artwork Imagine Logo with Three Colors Beach Cabin 3D Android Tablet with Different Screens Studio Apartment Red Figured Greek Vase on Blue Background Silver and Gold Flashlight Lake on Fire

RESTful Post: HTML Form

Page 3

HTML, PHP, MySQL

Enter your user name, password, and favorite color in the form below. This example demonstrates how to use basic RESTful HTML post, in an HTML form, for PHP and MySQL. The end result displays a Web page table derived from the posted MySQL data.

The form's action attribute, receives the value tables/post-colors.php. The form's method attribute, receives the value post. When the user taps the form's submit button, then PHP file, post-colors.php, receives data posted from the form. See the form's HTML markup, below.

User Name:
Password/Email:
Favorite Color:
Submit to Database:

HTML Markup

<!doctype HTML>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Post to PHP</title>  
<meta name="description" content="Form that posts to PHP."/>   
    
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
@import url(../styles/base.css); 
</style> 
<link rel="shortcut icon" href="../../7c.ico" />	
</head>
<body>
<nav>
<a 
 class="txt" 
 href="https://code.7Thunders.biz/index.php" 
 title="Home">
  Home
</a>
</nav>
<div 
 class="content"
>
<h1>Post to PHP</h1>

<form action="tables/post-colors.php" method="post">
 <div>User Name:</div>
 <input type="text" name="user"  value="user"/>
 <div>Password/Email:</div>
 <input type="text" name="pwd" value="pwd"/>
 <div>Favorite Color:</div>
 <input type="text" name="data" value="blue"/>
 <div>Submit to Database:</div>      
 <input type="submit" value="Post Data">   
</form>

</div>
<footer>
 <a class="txt" 
  href="https://code.7Thunders.biz/site-map.php" 
  title="Site Map">Site Map
 </a>
</footer>
</body>
</html>

Try It!

Try the Post to PHP example described in this tutorial.


Ads >
Create 3D Games: Learn WebGL Book 2 Simple Shaders: Learn WebGL Book 4
3D Programming for Beginners: Learn WebGL Book 1

for Web graphics!

Copyright © 2022 Amy Butler. All Rights Reserved.