Welcome To The Contact Database
"; echo "You have the following choices:"; echo "
"; echo " List Organizations in the database.

"; echo "Search for a service provider by keyword.

"; echo "Enter a new service provider.

"; echo "Edit an existing record.

"; echo ""; echo "

"; } /* The records appear in a table */ Function Show_Table (){ global $hostname, $password, $user; echo "

Service Providers

"; echo "

Click on the Service Provider to see the full record.

"; mysql_connect("$hostname", "$user", "$password"); $result = mysql("services","SELECT * FROM organization"); echo ""; $total_rows = mysql_numrows($result); $counter = 0; echo ""; while($counter < $total_rows) { $uid = mysql_result($result,$counter,uid); echo "\n"; echo "\n"; echo "\n"; $counter = $counter + 1; } echo "
UIDService ProviderPhone Number
\n"; echo mysql_result($result,$counter,uid); echo ""; echo mysql_result($result,$counter,org); echo "\n"; echo "\n"; echo mysql_result($result,$counter, phone); echo "
"; } Function Empty_Form (){ global $state, $org, $email, $phone, $fax, $address1, $address2, $URL, $uid; echo "

Contact Form

\n"; echo "

\n"; echo " \n"; echo " \n"; echo " Service Provider:

\n"; echo " Email:

\n"; echo " Phone:

\n"; echo " Fax:

\n"; echo " Campus Address:

\n"; echo " URL:

\n"; echo " Describe a Service

\n"; echo "

\n"; echo "
\n"; } Function Insert_Record () { global $state, $org, $email, $phone, $fax, $address1, $address2, $URL, $uid; mysql_connect("luna","maggot","fzr400dead"); $result = mysql("services","SELECT now()"); $now = mysql_result($result,0,"now()"); $result = mysql("services","INSERT INTO organization (org,phone, fax, email, address_1, address_2, URL) VALUES ('$org', '$phone', '$fax', '$email', '$address1', '$address2', '$URL')"); $new_uid = mysql_insert_id(); $result = mysql("services","INSERT INTO service (uid, entry_date, service) VALUES ('$new_uid', '$now', '$service')"); $state = Show_Record; }; /* Function Print_Contact (){ mysql_connect("luna","maggot","fzr400dead"); $result = mysql("services","SELECT * FROM contacts WHERE uid = $uid"); $name = mysql_result($result,1,"first_name"); $name = $name . " " . mysql_result($result,0,"last_name"); echo "Contact Information For $name"; echo ""; echo ""; echo "

Contact Information For $name

"; echo ""; echo ""; echo ""; $result = mysql("services","SELECT * FROM contacts WHERE uid = $uid"); echo ""; echo "\n"; echo ""; echo "\n"; $email = mysql_result($result,0,"email"); echo ""; echo "\n"; echo "
Name$name
Phone"; echo mysql_result($result,0,"phone"); echo "
Fax"; echo mysql_result($result,0,"fax"); echo "
Email Address $email"; echo "
"; echo "
"; echo "\n"; echo "\n"; echo "
"; echo "


"; echo "

Comments For This Contact

"; echo "
"; $result = mysql("services","SELECT * FROM comment WHERE uid = $uid ORDER BY contact_date"); $total_rows = mysql_numrows($result); $counter = 0; echo ""; echo ""; while($counter < $total_rows) { echo ""; $counter = $counter + 1; } echo "
DateComment
"; echo mysql_result($result,$counter,"contact_date"); echo ""; echo mysql_result($result,$counter,"contact_comment"); echo "
"; echo "

Add new comment below."; echo "

"; echo "


"; echo "

"; echo "

"; echo "

"; echo "

"; echo "

"; echo "
"; echo "
\n"; } */ /* The main loop. Call functions based on the value of $state, which gets set via a hidden INPUT TYPE. */ switch($state) { case ""; start_page(); break; case "list"; Show_Table(); break; case "create"; Empty_Form(); break; case "insert"; Insert_Record (); break; case "edit"; Show_Table(); break; case "fullrecord"; Show_Full_Record(); break; Show_in_Form($state, $uid); break; case "search"; break; } ?>