Posts

Showing posts from 2015

How to Convert HTML content to PDF

Image
How to Convert HTML to PDF Hello here we are going to show hpw easily you can convert html content to pdf file.First of all download the library of htm2pdf and include in your page. HTML2pdf library has function call writeHTML which is use to print the html content in pdf. Let’s start Step 1                Download the html2pdf library Step 1                 Create a new folder in your server and paste the html2pdf library into it Step 2                  Create a new file and save that file as index.php Step 3                  Now Start coding                  Include html2pdf library in index.php file                  Like this             ...

Read and write json file with php and mysql

Image
JavaScript Object Notation or JSON is a lightweight data-interchange format which is very easy to read and write, we use JSON to transfer data from server to web-application or vice versa as an alternative to XML. In this post I will be showing you how to read and write JSON file with php and mysql. What is json? How does it looks?  JSON is nothing but a data format similar like arrays. It comes in key value pair e.g. {Name:Rahul, Age:22}. JSON is a human-readable text format that is completely language independent but uses conventions of programming language like C, C++, JavaScript. See how JSON data looks like. [ { "player_name": "Sachin Tendulkar", "country": "India", "sports": "Cricket" }, { "player_name": "Roger Federer", "country": "Switzerland", "sports": "...

convert Json data to Php Array

How To convert Json data to Php Array json_decode ( ) - Decode JSON Formatted Data The json_decode() PHP function converts JSON data to PHP array data. Parameters data The json data that you want to decode in PHP. dataTypeBoolean Optional boolean that makes the function return a PHP Associative Array if set to "true", or return a PHP stdClass object if you omit this parameter or set it to "false". Both data types can be accessed like an array and use array based PHP loops for parsing. depth Optional recursion limit. Use an integer as the value for this parameter. options Optional JSON_BIGINT_AS_STRING parameter. A very simple example: <?php $jsonData = '{ "user":"John", "age":22, "country":"United States" }'; $phpArray = json_decode($jsonData); print_r($phpArray); foreach ($phpArray as $key => $value) {     echo "<p>$key | $value</p>"; } ...

How To Convert JSON Data Into Html Table Using Javascript jQuery

Image
In this tutorial i am going to explain about how to display the json data into html table using javascript & jquery. For explaining how we convert the json data into html table using javascript & jquery we have created a json file that contains the below json data. Json File [ {"Model" : "Iphone 18", "Name" : "iOS", "Share" : 57.56,"Price Range":"$800 - $1000","Brand":"Apple"},  {"Model" : "Nexus 23", "Name" : "Android", "Share" : 24.66,"Price Range":"$600 - $800","Brand":"Samsung"},  {"Model" : "Tom-tom", "Name" : "Java ME", "Share" : 10.72,"Price Range":"$200 - $900","Brand":"X Brand"}, {"Model" : "Nokia 66610", "Name" : "Symbian", ...

add-remove-input-fields-dynamically-with-jquery

Image
                       If you are looking to add and remove duplicate input fields, here’s jQuery example below to do the task for you. This jQuery snippet adds duplicate input fields dynamically. JQUERY FILE $ ( document ) . ready ( function ( )   {       var   max_fields       =   10 ;   //maximum input boxes allowed       var   wrapper           =   $ ( ".input_fields_wrap" ) ;   //Fields wrapper       var   add_button       =   $ ( ".add_field_button" ) ;   //Add button ID           var   x   =   1 ;   //initlal text box count       $ ( add_button ) . click ( function ( e ) {   //on add input button click       ...

Uploading Images with unique file name In PHP

Uploading Images with unique file name In PHP ================================================================== $random=rand(1,10000);//For making file unique... $directory='Uploads/'; $filename=$_FILES["user_image"]["name"]; $tempname=$_FILES["user_image"]["tmp_name"]; $filepath=$directory.$random.$filename; move_uploaded_file($tempname,$filepath);