Lateral Code
A Web Development Blog Focused on Code and Technology
Currently Browsing: Home » Posts tagged 'html' (Page 2)
Posts Tagged ‘html’
Building a contact form with HTML and PHP
By Patrick Lin on Monday, January 19th, 2009 | Tags: html, php | 5 Comments »
A while back, my colleague Karthik posted a CSS styled form. This time, I am going to show how to build the backend of an HTML form using PHP.
To begin with, you can take the code from Karthik’s example and paste it into a file called ‘contact.php’ or a name of your own choosing.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" >
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Form Styling!</title>
</head>
<body>
<h2>Input Form</h2>
<form id="input-form" name="input-form">
<label for="first-name">First Name: </label>
<input type="text" id="first-name" name="first-name" class="field" />
<label for="last-name">Last Name: </label>
<input type="text" id="last-name" name="last-name" class="field" />
<label for="e-mail">E-mail: </label>
<input type="text" id="e-mail" name="e-mail" class="field" />
<label for="text">Message: </label>
<textarea id="text" name="text" class="field"></textarea>
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
</body>
</html>