Category: PHP

Unzip file in server using PHP ZipArchive

Once i wanted to upload WordPress folder which contains 1000’s of files, if i choose to upload those files using FTP it will take much time.So i decided to upload it as zip file and extract it using php code. After googling i got a good source, how to extract / unzip file in server. […]

Read More…

Clear form fields after finishing ajax submit using Jquery

Use reset() method to clear form fields after submitting the form via ajax. $.ajax({ type:"POST", url:formUrl, data:formData, beforeSend:function(){ $(‘.status’).html(‘<b>Form is being submitted</b>’); }, success:function(data){ $(‘. status ‘).html(‘<b>Thank you!! We have received your form</b>’); }, complete:function(){ $(‘#form-id’).each(function(){ this.reset(); //Here form fields will be cleared. }); }});

Read More…

Download files from multiple URL s and download it as zip format

Hello friends, here is the code for how to download files from multiple url and download is as zip format in PHP.If you have any doubt in PHP function’s please refer php.net. Let’s start!!! We can give url’s as array format like below <?php $urls = array( ‘http://skidvis.com/WordpressCheatSheet.pdf’, ‘http://andywibbels.com/files/WordPress_Cheatsheet_v1.pdf’ ); ?> Create a random folder […]

Read More…

Passing Javascript variables to PHP

It’s easy to get Javascript variable into PHP. What you have to do is follow below code. //in script blockvar veg = ‘Carrot’;//in php block$veg = "<script type=’text/javascript’>document.write(veg);</script>";echo ‘Printed My JS variable into PHP: ‘.$veg; Result will be:Printed My JS variable into PHP: Carrot

Read More…