Some HTML:
<html>
<head>
<title>Book-O-Rama - New Book Entry</title>
</head>
<body>
<h1>Book-O-Rama - New Book Entry</h1>
<form action="insert_book.php" method="post">
<table border="0">
<tr>
<td>ISBN</td>
<td><input type="text" name="isbn" maxlength="13" size="13"></td>
</tr>
<tr>
<td>Author</td>
<td> <input type="text" name="author" maxlength="30" size="30"></td>
</tr>
<tr>
<td>Title</td>
<td> <input type="text" name="title" maxlength="60" size="30"></td>
</tr>
<tr>
<td>Price $</td>
<td><input type="text" name="price" maxlength="7" size="7"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Register"></td>
</tr>
</table>
</form>
</body>
</html>
Using html-tag-generators
:
<?php
require('html-tag-generators-wrapper.inc');
$site_title = 'Book-O-Rama - New Book Entry';
function text_input($name, $maxlength, $size)
{
return input(array('type' => 'text', 'name' => $name, 'maxlength' => $maxlength, 'size' => $size));
}
echo html(
head(title($site_title)),
body(
h1($site_title),
form(array('action' => 'insert_book.php', 'method' => 'post'),
table(array('border' => 0),
tr(td('ISBN'), td(text_input('isbn', 13, 13))),
tr(td('Author'), td(text_input('author', 13, 13))),
tr(td('Title'), td(text_input('title', 13, 13))),
tr(td('Price'), td(text_input('price', 13, 13))),
tr(td(array('colspan' => 2), input(array('type' => 'submit', 'value' => 'Register'))))))));
?>
Have you thought about putting these functions in a namespace like
html
?