PHP 5 Database Form Example


Henry Chen

The following example shows how to integrate all the database operation (insert, update, delete and select) in one PHP script. It is in PHP5 and MySQL, and can be easily modified to any DBMS.

Contact Management Main Form

Contact Management Edit Form

ContactManagement.php

<? /*   CREATE TABLE contacts (   `id` int(10) NOT NULL auto_increment,   `first_name` varchar(30) NOT NULL default '',   `last_name` varchar(50) NOT NULL default '',   `email` varchar(75) default NULL,   `contact_status` tinyint(1) NOT NULL default '0',   PRIMARY KEY  (`id`) ) TYPE=MyISAM  ; */ ?> <html> <head> <title>Manage Contact's data</title> </head> <body> <?php /* control code for application */ //submit button was pressed so call the process form function if (isset($_POST['submit'])) {   process_form();   die(); }//end if //call the get_data function if (isset($_GET['id'])) {   get_data(); }//endif //nothing chosen so list the contacts if ((empty($_POST))&&(empty($_GET))) {   list_users();   die(); }//end if //request to add a new contact so call the…

View original post 1,085 more words

Advertisements
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , , , , , ,
Posted in php

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow php tutorial on WordPress.com
categories
Calendar
April 2014
M T W T F S S
« Mar   May »
 123456
78910111213
14151617181920
21222324252627
282930  
Follow me on Twitter
Blog Stats
  • 73,741 hits
%d bloggers like this: