الفصل الثالث
76
البرنامج النصي customDB.php (تابع)
54.
}
55.
56.
57.
58.
?>
59.
60.
61.
function add_address__form() {
global $page;
<h3>Add An Address:</h3>
<form action=<?=$page?> method=post>
<p>First Name: <input type="text" name="first">
62.
63.
<br>Last Name: <input type="text" name="last"> <br>Home: <input type="text" name="home">
64.
<br>Cell: <input type="text" name="cell">
65.
66.
67.
68.
<br>Work: <input type="text" name="work">
<p><input type="submit" name="add_address" value="Add Entry!">
</form>
<?
69.
}
70.
71.
72.
73.
74.
/***** MAIN *****/
?>
<h3>Address Book</h3>
<p><a href=<?=$page?>?action=add>Add An Entry</a>
<p>
75.
<?
76.
77.
78.
79.
80.
81.
82.
}
83.
84.
$dbconn = connectDB ($db);
if(isset($add_address)) {
if(!add_address ($db, $HTTP_POST_VARS)) {
echo "<h3>ERROR ADDING ENTRY!</h3>";
} else {
echo "<h3>ENTRY ADDED!</h3>";
} elseif(isset($action) && $action == "add") {
add_address_form();
85.
}
86.
?>
87.
88.
<?
89.
<h4>Current Addresses: </h4>
display_addresses ($db);
ص٧٦