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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.