Online or Offline Address Book

The address book is an essential part of our life since centuries. With digital evolution, these books are replaced with software and when the smartphone came, the first thing they added into their system are contacts alias Address books. 

In this article, we will learn how we can develop a simple address book in PHP, HTML, and MySQL. Also at the end of this article, I have added download links for other programming languages such as VB, Java and .Net. 

For the PHP Application, the first thing we will need to do is to create a basic form to get the information from the User.

The information would be like the First Name, Last Name, Mobile, Phone and Address

And to store this information on the backend, we will create a database address books with one table called contacts. 

This table will have columns like id, first_name, last_name, mobile, phone and address where id is our primary key and needs to be autoincremented.

Create Database with the name of AddressBooks. I am doing it using PHPMyAdmin but you can do it directly using MySQL terminal or using MySQL WorkBench.

Create Table with the name contacts having 5 fields. Just make sure to set id as Primary key and check auto Increment option.

 

 

 

 

 

 

 

Step 1) In your webserver root folder, create a new folder with the name of addressbooks

Step 2) Create an index.php file inside this folder and open it to your favorite editor. I prefer Sublime text but you can choose any one of your choice

Step 3) Copy the HTML Boilderplate from this site and paste it inside the index.php file we created in Step 2. 

Step 4) Create HTML Form:


<!DOCTYPE html>
<html>
<head>
<metacharset="UTF-8">
<title>Add Contact Form</title>
<linkrel="stylesheet"href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"crossorigin="anonymous">
</head>
<body>
<form>
<divclass="form-group">
<labelfor="firstName">Name</label>
<divclass="row">
<divclass="col">
<inputtype="text"class="form-control"id="firstName"placeholder="First Name">
</div>
<divclass="col">
<inputtype="text"class="form-control col-sm"id="lastName"placeholder="Last Name">
</div>
</div>
<divclass="form-group">
<labelfor="exampleInputEmail1">Email address</label>
<inputtype="email"class="form-control"id="exampleInputEmail1"aria-describedby="emailHelp"placeholder="Enter email">
<smallid="emailHelp"class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<divclass="form-group">
<labelfor="phoneInput">Phone</label>
<inputtype="tel"class="form-control"id="phoneInput"placeholder="Phone">
</div>
<divclass="form-group">
<labelfor="addressInput">Address</label>
<textareaname="address"class="form-control"placeholder="Address"></textarea>
</div>
<buttontype="submit"class="btn btn-primary">Submit</button>
</form>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>

Step 5) Post this form on the backend

Step 6) Fetch the values in the backend

Step 7) Store values into the database

Step 8) Create New page to show all this values

Step 9) Pagination 

submit.php file

<?php
   $connection = mysqli_connect("localhost","root","root","addressbook");
   
   if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   	if(isset($_POST['first_name'])) {

   		$first_name = $_POST['first_name'];
   		$last_name = $_POST['last_name'];
   		$phone = $_POST['phone'];
   		$address = $_POST['address'];
   		$insert_sql = "INSERT INTO contacts 
   					   (first_name, last_name, phone,address)
				VALUES('$first_name', '$last_name', '$phone', '$address');";
			
		 $result = mysqli_query($connection, $insert_sql);
		 
		 if($result){
		 	echo "Succesfully Added <br /><hr /><br /><br />";
		 }		
   	}
         $sql = 'SELECT * FROM contacts';
         $result = mysqli_query($connection, $sql);
        
         if (mysqli_num_rows($result) > 0) {
            while($row = mysqli_fetch_assoc($result)) {
               echo "Name: " . $row["first_name"].' '.$row["last_name"]. "<br>";
                echo "Phone: " . $row["phone"]. "<br>";
                echo "Address: " . $row["address"]. "<br>";
                echo "<hr />";
            }
         } else {
            echo "0 results";
         }
         mysqli_close($connection);
?>

This will be great project if you can build good and optimized address book software for Mobile software with reminder. If you want you can develop online application having latest features such as reminding using emails and sms.This project will sharpen your concept and develop your business sense.

Download SourceForge.net Source Code of PHP Address Book

Download Java Swing Address book

VB 6 Address Book

VB 2005 Address Book and Event Reminder

Dot Net Application with source code in C#

JContact is an online address book management application. It is web
based J2EE application build on JSF, Spring and Hibernate. The web2.0
framework Rich Faces makes the application more interactive.
 

Address book reloaded This is a PHP addressbook web application to store contact
details of employees/customers in utf8 format on an intranet or website;
features Google Maps, distributed management, PDF address books,
plugins, styles. DEMO: http://tab-2.sourceforge.net/

Online Address Book (OAB) is an open source PHP web application designed
for persistant, web-based storage of contact information. It provides a
flexible and convenient interface, and supports importing and exporting
vCards.

Comments >>