Code Snippets

Multiple File Upload Form

In this post I am going to show you how to create a form that allows uploading multiple files at once. There is nothing much complex about this. As you’ll see the trick is in how we configure the file upload field. Here is the html with the form: In the above markup, pay your… read more »

Formatting Currency Values

You can format any numeric value to have decimal points by the use of PHP’s number_format() function. This is ideal when you want to deal with currency values. Below I have shown an example of how this works: On line 3 we have the $price variable with its value set to 10. On line 5… read more »

Syncing an Audio Clip with Text captions

Below analysis and code sample is posted as an answer to this question posted on Facebook groups. If you go to the page and enable its ‘view source’, you should see they are loading few javascript libraries. jquery, and jquery-ui should be familiar to most of you. They also load a jquery plugin called… read more »

Updating a MySQL table with MySQLi

Below code sample is posted as an answer to this question posted on Facebook groups. Create a new database with phpMyAdmin and execute below SQL query in its SQL tab to create a new table called ‘notes’. It will have three fields. id, title and contents. Then’ll lets populate it by adding a single record…. read more »

PHP Countdown Timer

The following php snippet can be used to display a countdown timer on a web page. First we need to start a PHP session by calling the session_start() function: Then set the default time zone for your region. I am in Sri Lanka so I set it to Asia/Colombo Now add below code block: In… read more »


Do NOT follow this link or you will be banned from the site!