In the previous tutorial, we discussed the code for database connectivity in PHP using functions. That code can be seen in the folder admin with the file name “admin 2008″ and in “process.php” files. We had also discussed about the login and the Signup module designs along with the DB connectivity. In this post, we are going to see about the UI level design for various departments. In addition there is a separate module for composing mails. We will see the coding for the mail composing module.
While defining the fields for attachments and mail body sections, the blob and medium blob data types come into picture. These data types are useful when defining image and other formats or huge block of text. These data types can be defined when creating the database. We are going to see the PHP code snippet for posting a mail along with the attachment in the DB. The following is the code which has been demonstrated along with the use of functions. The UI is very simple an it can be extended according to the user’s needs. The UI level coding for the mail composing module can be seen here: compose mail
function compose ()
if( !empty($from) && !empty($to) && !empty($subj) && !empty($body) )
$adb= new admindbase ();
if( !empty($tfname) )
$query=sprintf(“insert into mails (source,dest,subject,attach,body) values(‘%s’,’%s’,’%s’,’%s’,’%s’)”,$from,$to,$subj,$attch,$body);
if( $adb->__write($query) ==1 )
$_POST[‘sts’]= “email send to “. $to;
$_POST[‘sts’]= “email failed send to “. $to;
$_POST[‘sts’]= “field missing”;
For attaching the file to the mail and retrieving it for the recipient, the following code has been demonstrated using functions. For interconnecting systems, we have to install WAMP server a tool which integrates PHP Apache MySQL for running and deploying the system.
- For deploying it online WAMP server can be launched from system tray.
- Do a left click and from the set of options shown kindly select Put Online option.
- Find out the IP address of the system which runs WAMP along with the complete path where the application is placed.
- Open the browser and type the IP address of the system along with the path of the folder in the client system eg. 192.168.1.32/path to the folder.
- The home page appears and we can start using the website.
$adb= new admindbase ();
$user = $_POST[‘user’];
$query =sprintf( “select * from mails where dest=’%s'”,$user);
for ( $i=0; $i<count($rs); $i++)
echo $rs [$i][‘source’] . ““.$rs[$i][‘subject’] .”
The complete UI level coding can be found in this link: Durofy
Do provide your valuable comments after going through these tutorials which can help me in posting further tutorials for building live applications!