Version: 1.0
Type: Full Script
Category: Other
License: Other
Description: This is a very simple address book intended to handle all your organizational contacts.
Add, edit and view the contact details, or manage the address book through a web browser from any platform. It allows you to store Name, Address, City, Phone and E-mail information in one place. So you can collectively access all the details about your contacts. Address Book can be shared among multiple users in accordance with the defined users and terminals. It is appropriate for sharing contacts and making the directory available to various users. Address Book script comes in a ZIP file, comprising: a PHP coding file, Screen shots and a Document of description. Address Book is available free of charge.
<?php //address_book.php //see record in address book /* create table in your database CREATE TABLE useraddress ( user_id int(4) NOT NULL auto_increment, user_name varchar(30) default NULL, user_address varchar(250) default NULL, user_city varchar(100) default NULL, user_phone varchar(30) default NULL, user_email varchar(30) default NULL, PRIMARY KEY (user_id) ) TYPE=MyISAM; */ //database connection //connect.php $host_name = "localhost"; $username = "root"; $password = "root"; $db_name = "test"; $link = mysql_connect($host_name, $username, $password) or die(mysql_error()); $selectdb = mysql_select_db('test',$link) or die(mysql_error()); //connect to database include("connect.php"); ?> <html> <head> <title>Address Book</title> </head> <body> <h2>Address Book</h2> <table border cellpadding=3> <tr> <th width=100>Name</th> <th width=100>Adress</th> <th width=200>City</th> <th width=100>Phone</th> <th width=100>E-mail</th> <th width=100>Edit</th> </tr> <? $select_info = "SELECT * FROM useraddress ORDER BY user_name ASC"; $exec_info = mysql_query($select_info); //Print "<td colspan=5 align=right><a href=" .$_SERVER[PHP_SELF]. "?mode=add>Add Contact</a></td>"; while($fetch_info = mysql_fetch_object($exec_info)) { ?> <tr> <td><? echo $fetch_info->user_name;?></td> <td><? echo $fetch_info->user_address;?></td> <td><? echo $fetch_info->user_city;?></td> <td><? echo $fetch_info->user_phone;?></td> <td><? echo $fetch_info->user_email;?></td> <td><a href="update_add.php?id=<? echo $fetch_info->user_id;?>">Update</a></td> </tr> <? } ?> </table> <table> <tr> <td> </td> </tr> <tr> <td><a href="add_address.php">Add Address ?</a></td> </tr> </table> </body> </html> <? //add information in address_book //add_address.php $check = $HTTP_POST_VARS['mode']; include("connect.php"); if(2 == $check) { $name = trim($HTTP_POST_VARS['name']); $address = trim(addslashes($HTTP_POST_VARS['address'])); $city = trim($HTTP_POST_VARS['city']); $phone = $HTTP_POST_VARS['phone']; $email = $HTTP_POST_VARS['email']; $insert_data = "INSERT INTO useraddress (user_id, user_name, user_address, user_city, user_phone, user_email) VALUES (NULL, '$name', '$address', '$city', '$phone', '$email')"; $exec_insert = mysql_query($insert_data); if(!$exec_insert) { echo "Your Data Not Inserted Properly, Please try again"; } else { echo "<font color = 'red'><b>Your Data Inserted Properly</b></font>"; } } ?> <html> <head> <title>Address Book</title> </head> <body> <form action="<? echo $PHP_SELF;?>" method="post"> <table> <tr><td>Name:</td><td><input type="text" name="name"></td></tr> <tr><td>Address:</td><td><input type="text" name="address"></td></tr> <tr><td>City:</td><td><input type="text" name="city"></td></tr> <tr><td>Phone:</td><td><input type="text" name="phone"></td></tr> <tr><td>Email:</td><td><input type="text" name="email"></td></tr> <tr><td colspan="2" align="center"><input type="submit" value="Submit Data"></td></tr> <input type="hidden" name="mode" value="2"> </table> </form> <table> <tr> <td> </td> </tr> <tr> <td><a href="address_book.php">Address Book</a></td> </tr> </table> </body> </html> <? //update information in address book //update_add.php include("connect.php"); $user_id = $HTTP_GET_VARS['id']; $check = $HTTP_POST_VARS['mode']; if($user_id != '') { $select_info = "select * from useraddress where user_id=".$user_id; $exec_info = mysql_query($select_info); $fetch_info = mysql_fetch_object($exec_info); $user_name = $fetch_info->user_name; $user_address = $fetch_info->user_address; $user_city = $fetch_info->user_city; $user_phone = $fetch_info->user_phone; $user_email = $fetch_info->user_email; } if(2 == $check) { $name = trim($HTTP_POST_VARS['name']); $address = trim(addslashes($HTTP_POST_VARS['address'])); $city = trim($HTTP_POST_VARS['city']); $phone = $HTTP_POST_VARS['phone']; $email = $HTTP_POST_VARS['email']; $userid = $HTTP_POST_VARS['userid']; $update_data = "update useraddress set user_name = '$name', user_address = '$address', user_city = '$city', user_phone = '$phone', user_email = '$email' where user_id = ". $userid; $exec_update = mysql_query($update_data); if(!$exec_update) { echo "Your Data Not Update Properly, Please try again"; } else { echo "<font color = 'red'><b>Your Data Update Properly</b></font>"; } } ?> <html> <head> <title>Address Book</title> </head> <body> <form action="<? echo $PHP_SELF;?>" method="post"> <table> <tr><td>Name:</td><td><input type="text" name="name" value="<? echo $user_name;?>"></td></tr> <tr><td>Address:</td><td><input type="text" name="address" value="<? echo $user_address;?>"></td></tr> <tr><td>City:</td><td><input type="text" name="city" value="<? echo $user_city;?>"></td></tr> <tr><td>Phone:</td><td><input type="text" name="phone" value="<? echo $user_phone;?>"></td></tr> <tr><td>Email:</td><td><input type="text" name="email" value="<? echo $user_email;?>"></td></tr> <tr><td colspan="2" align="center"><input type="submit" value="update Data"></td></tr> <input type="hidden" name="mode" value="2"> <input type="hidden" name="userid" value="<? echo $user_id; ?>"> </table> </form> <table> <tr> <td> </td> </tr> <tr> <td><a href="address_book.php">Address Book</a></td> </tr> </table> </body> </html>