PHP Tutorials

Enable image upload option in CKEditor using PHP




In this tutorial I will explain how to enable image upload option in CKEditor using PHP. To enable image upload option in CKEditor, follow steps as explained below. Integrate CKEditor Include following line in your view where you want to use ckeditor and place your ckeditor folder in root folder. Now add class ‘ckeditor’ to the textarea like below: Enable image upload option in ckeditor In ckeditor > config.js file …

Continue reading




Get current Indian time in PHP




In this tutorial I will show you to get current indian time in PHP using DateTimeZone and DateTime function. First get the DateTime object and set indian timezone to this DateTime object. Now format the output as in the following example.




Convert Uppercase to Lowercase without using PHP string functions




In this tutorial I will show you, how to Convert Uppercase to Lowercase, Lowercase to Uppercase without using PHP string functions. Let’s take a simple example of convert uppercase to lowercase and lowercase to uppercase. Explanation: ASCII values of lowercase characters(a-z) are from 97-122 and ASCII values of uppercase characters(A-Z) are from 65-90. ORD() function returns ASCII value of character. Difference between ASCII values of lowercase characters to uppercase character …

Continue reading




Send multiple emails at once using PHPMailer

Send multiple emails at once using PHPMailer




In this tutorial I will show you how to send multiple emails at once using PHPMailer. Example Code: In following example we have an array of email and content to be sent. So we have created an object on PHPMailer and sending email in for loop. Now most important part of this example is at the end. If you not mention “$mail->ClearAddresses();” , Then all email id except the last …

Continue reading




Get full URL from address bar in PHP




InĀ  this tutorial I will show you how to get full URL from address bar in PHP. To get URL in PHP, we need to useĀ predefined variable $_SERVER. $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. for example browser address bar showing following URL : www.domain.com/product.php?var=1&var=2 will return www.domain.com and will return /product.php?var=1&var=2 Now …

Continue reading




Send email with attachment using phpmailer

Send email with attachment using phpmailer




In this tutorial I am going to show you how to send email with attachment using phpmailer. I have already write a tutorial on How to Send Email in PHP it included attachment also. Now in this tutorial, I will write send email with attachment using phpmailer. Simple Code: This is the simple code to send email to any one with attachment. If you want more option in attachment like …

Continue reading




Prevent multiple POSTs when refresh in PHP




In this tutorial I will show you how to prevent multiple POSTs when refresh the page in PHP. For example a user is on contact us page and he fill the information and submit the form and than he refreshed the page for some reason. So this way duplicate entries can be inserted into database. Simple Form Page Example <?php // Database configs $host=”localhost”; $dbuser=”root”; $dbpass=””; $dbname = “simpledb”; // …

Continue reading




Zend Framework 2 Installation via Composer




In this tutorial I will explain the steps for Zend Framework 2 Installation via Composer. Steps for install Zend Framework 2 Installation via Composer First set environment variable D:\xampp\php in Advanced system settings. Download and install composer from https://getcomposer.org/Composer-Setup.exe once you installed automatically composer variable will be added into environment variables (C:\ProgramData\ComposerSetup\bin;) Now download and install git from http://msysgit.github.io/ Like below screenshot, select 2nd option when you install. Once you …

Continue reading