FAQ

How to create excel files in PHP?

Some time ago I found a class on phpclasses.org by Harish Chauhan which makes it incredibly easy to generate simple excel spreadsheets from PHP. I found it useful so I want to share its usgae with readers too. I also made some changes to the class for styling the rows.

Here is the process:
1- Include [...]

Read the rest of this entry >>

FAQ, php

Getting and setting value of html elements using jQuery

If you have started using jQuery recently and you  are used to DOM methods of getting and setting values for form and html elements, this article is for you.
Using jQuery can be confusing in the beginning but it is a lot easier once you get hold of it. In this post I will summarize methods [...]

Read the rest of this entry >>

FAQ, javascript

Quick PHP Tip: How to parse CDATA sections using SimpleXML

Applies to:  simplexml_load_string and simplexml_load_file
Problem : SimpleXML does not parse text inside CDATA tags in an XML.
Consider the XML below:

 
$str = ‘<rootNode>’;
$str.=’<childNode>some text goes here</childNode>’;
$str.=’</rootNode>’;

To parse it we use following syntax:

$xml = simplexml_load_string($str);

On printing it outputs:

 
SimpleXMLElement Object
(
[childNode] => some text goes here
)

Thats OK. Now the same xml but this time the [...]

Read the rest of this entry >>

FAQ, php

FAQ(Javascript) : User confirmation on close button of browser

Problem: On clicking the close button of browser ask for user confirmation with a custom message
Solution: Use the window.onbeforeunload method. This method expects a string value. This string will be displayed to user along with the default string. Default string that is displayed to user is:
Are you sure you want to navigate away from this [...]

Read the rest of this entry >>

FAQ, javascript

PHP – Turn register globals on off using htaccess

Problem:
My application is hosted on a server where php has register_globals set to on in php.ini. But using register_globals = on makes code error prone and is dangerous to use.
I want to turn it of for my application regardless of what is its setting for other applications.
Since the value of register_globals cannot be set at [...]

Read the rest of this entry >>

FAQ, php
9,438 spam comments
blocked by
Akismet