Creating the Record Addition Mechanism

Just because you'll potentially be adding information to six different tables doesn't mean your form or script will be monstrous. In fact, your scripts won't look much different from any of the ones you created in previous lessons, and with practice, you will be able to make these verbose scripts much more streamlined and efficient.

In Listing 18.2, you can see a basic record addition script, called addentry.php.

Listing 18.2. Basic Record Addition Script Called addentry.php
  1: <?php 2: if ($_POST[op] != "add") { 3: //haven't seen the form, so show it 4: $display_block = "<h1>Add an Entry</h1> 5: <form method=\"post\" action=\"$_SERVER[PHP_SELF]\"> 6: <P><strong>First/Last Names:</strong><br> 7: <input ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.