Saturday, 3 August 2013

Save php file as word and excel

In this article lets see how a simple application form which is designed using PHP can be save as word and excel. Onclick the save as word and save as excel ,this php file can be converted into word as well as excel.

Application form

Name
Father name
Occuption
State
Gender MaleFemale


Friday, 2 August 2013

Onclick the selectbox values and shown in textbox

Nowdays we can see in all online application form there would be select your college names or qualification option and  if your college name is not available in that option values we can use others option. on clicking that others option we get the textbox, in that text box we can enter our college name or qualification.Lets see the live demo.

Live Demo :

Select Ur Qualification : 

Lets see how it works,

Wednesday, 31 July 2013

Implode and Explode the data from database in php

Implode means return a string from the elements of an array that means it converts an array into the srting.Explode split a string by string,it change a string into an array. 

      For example consider a simple driving form,


<form name="aform" method="post" action="conn.php" onsubmit="return validation();">
<table border="0px" cellpadding="10" cellspacing="0" id="tbl">
<tr><td align="center" colspan="2">Sample Driving Form</td></tr>
<tr>
     <td>Vehicle</td>
     <td><input type="checkbox" name="vehicle[]" value="bus" />bus
     <input type="checkbox" name="vehicle[]" value="car" />car
     <input type="checkbox" name="vehicle[]" value="bike" />bike</td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit" value="submit" /></td></tr>
</table>
</form>

Lets see the output

Sample Driving Form
Vehicle bus car bike

Serialize and Unserialize the datas in php

Serialize is used for storing and passing the values without losing their type and structure in PHP. If we need to store or pass the values without losing their type and structure use the function serialize as serialize() . Serialize() converts an array into the string values.

      For example: serialize(array('codetruster', 'php', 'css')) 
      Then this will be output a:3:{i:0;s:11:"codetruster";i:1;s:3:"php";i:2;s:3:"css";}

Unserialize is used to convert the actual data from the Serialized data. unserialize is used to convert the string datas into an array and display it on the browser. To convert the string datas into an array using the function unserialize().


      For example: 
                           array
  0 => string 'codetruster' (length=11)
  1 => string 'php' (length=3)
  2 => string 'css' (length=3)

Tuesday, 30 July 2013

Positioning and overlapping an element using CSS

The CSS positioning properties allow us to position an element.Elements can be positioned using the top, bottom, left, and right properties.There are more types of positioning they are static,fixed,absolute and relative.


<div id="containers">
  
    <div id="child"></div>
  
</div>