Saturday, July 16, 2016

Install Zend framwork 3 for PHP 7 in Windows 7

1. Backup your all projects and database first

2. Un install Xampp

3 . Reinstall Xampp

4. un install composer if you are using proxy for internet . Otherwise follow point 6.  From add/remove programs (To open add/remove programs write in run window appwiz.cpl and press enter)

5. Re install composer and give right proxy url with port eg 192.168.8.8:8888

6. uncomment extension=php_openssl.dll in php.ini for apache and restart apache

7. open git bash

8. composer create-project -n -sdev zendframework/skeleton-application path/to/install

or

composer create-project --stability="dev" zendframework/skeleton-application path/to/install

Note: path/to/install is your working directory path. so change name according to you

eg:   D:\xampp\htdocs\zf3-factory


9. write virtualhost in xampp\apache\conf\extra\httpd-vhosts.conf

   
       ServerName zf3-xyz.local
       DocumentRoot "D:\xampp\htdocs\zf3-xyz\public"
       SetEnv APPLICATION_ENV "production"  
       
         DirectoryIndex index.php
         AllowOverride All
         Require all granted
        


10. add virtualhost in C:\Windows\System32\drivers\etc\hosts  hosts is file open notepad and move this file to notepad

    127.0.0.1       zf3-xyz.local

11. Also add zf3-xyz.local to your proxy settings Exceptions area after ;

Note: use run command -->  inetcpl.cpl  --> select Connections  --> Click LAN Settings -->Click Advanced

4. write http://zf3-xyz.local/  on browser address bar or url and press enter

Wednesday, February 4, 2015

example: create chart using highchart api with different parameters

Here is given example of attempted question in particular time of online exam test. First showing image of generated graph .
Features of chart:-
1. scrollbar for pagination
2. show xaxis value on dataLabels rather than yaxis value
3. change dataLabels text color, background color for wrong/right questions.
4. customize tooltips according to need
5. View Demo

1. Include first jquery-1.7.1.min.js or latest version
2. after that add below code between javascript script tag
3. Here container is div id where chart will be draw
<script> 
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'line',
   /*renderTo: 'container',
   height:'600'*/   
    
            
        },
       
        yAxis: {
            min: 0,
            max: 50,
   tickInterval: 5,
    title: {
                text: 'Time (in minutes)',
    /*align: 'high',
                offset: 0,
                margin: 60
                rotation: 0,
                y: -10*/
    style: {
                    //color: 'Black',
     fontWeight:'bold',
     fontSize:14
                }
                
            }
        },
 
        xAxis: {
           /*  categories: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
           , */
   min:24.5, 
   tickInterval: 1,
      
      title: {
                text: 'Questions',
    style: {
                    //color: 'Black',
     fontWeight:'bold',
     fontSize:14
                }
                
            },
   minorTickLength: 0,
   tickLength: 25
        },
 tooltip: {
            crosshairs: true,
            shared: true,
   backgroundColor: '#ffffff',
            borderColor: 'gray',
            borderWidth: 1,
   formatter: function () {
                var s = 'Question ' + this.x + '';

                $.each(this.points, function () {
    totalSeconds =Math.floor(this.y*60) ;
    hours = Math.floor(totalSeconds / 3600);
    totalSeconds %= 3600;
    minutes = Math.floor(totalSeconds / 60);
    seconds = totalSeconds % 60;
    if(seconds<10 br="" hours="" if="" minutes="" s="" seconds="">Taken '+ hours+':'+ minutes + ':'+seconds + ' minutes 
('+ (this.y )+' X 60 seconds)';
                });

                return s;
            }
        },  
 title: {
            /*floating: true,
            align: 'left',
            x: 100,
            y: 40*/
   text: 'Time Compare Analisys',
        },

        subtitle: {
            text: '(with correct/in-correct questions)',
            floating: true,
            /*align: 'left',
            x: 100,*/
            y: 30
        },  
           
        plotOptions: {
            series: {
                dataLabels: {
                    enabled: true,
     zIndex: 10,
     padding:-15,
                   /* borderRadius: 5,
                    backgroundColor: 'rgba(252, 255, 197, 0.7)',
                    borderWidth: 1,
                    borderColor: '#AAA',
                    y: -6*/
                }
            }
        },

        series: [{
  dataLabels: {
                    enabled: false
     },
            type: 'line',
            color:'Grey',
            dashStyle: 'longDash',
            name: 'Regression Line',
            lineWidth:  1,
            data: [[0, 0], [49,50]],
            marker: {
                enabled: false
            },
            enableMouseTracking: false
        },{name: 'Taken Time',
            data: [0,{
                y: 4.23,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 13.7,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 4.73,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.38,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.17,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 1.02,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.48,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.98,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.95,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.6,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.6,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.3,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.32,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.28,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.42,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.4,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.13,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.08,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.08,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.12,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.15,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.13,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.12,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.47,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.02,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.23,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.13,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.22,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.17,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.2,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.12,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.15,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.12,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.05,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.1,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.08,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.03,
                color: 'green',
    shadow: true,
                 marker: {
               symbol: 'circle',
                radius: 12,    
               /* symbol: 'url(images/graph/correct_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            },{
                y: 0.25,
                color: 'red',
                 marker: {
     symbol: 'circle',
                radius: 12,
               /* symbol: 'url(images/graph/incorrect_1.png)',
                width: 43,
                height: 38,*/
                //rotate:30
            },
                dataLabels: {
                    formatter: function () {
                var o = '' + this.x + '';

                return o;
            },
                    padding: -10,
                    shadow: true,
                    style: {
                        fontWeight: 'bold',
                        color: '#fff'
                    },
                    
                }
            }]
        }],
         scrollbar: {
        enabled: true
        }
        
    });
});
//]]</script> 

4. include http://code.highcharts.com/stock/highstock.js before container div in body part
5. add code for div
<div id="container" style="height: 400px;width:800px;"></div>

Saturday, March 15, 2014

Diffrent For Loop Examples for PHP

Eg. 1.
            $space=20;
for($i=1,$k=1;$i<5 ;$i++) //loop for print rows
{
	for($l=1;$l<=$space;$l++)//loop for print space
	
	 	echo '&nbsp;';
	
		$space -=2;
		
		for($j=1;$j<=$i;$j++,$k++) /*loop for print columns*/
		
			echo $k.'&nbsp;';
			echo '<br>';	 
		
 }

       
Output:
                    1 
                  2 3 
                4 5 6 
              7 8 9 10 

Monday, March 10, 2014

Jquery with ajax example

Step by step use JQuery with Ajax

  1.  Add jquery-1.9.1.min.js or higher before call ShowUnit function
  2.  give loader image: <span id="loader" style="display: none;margin: 250px 0 0 450px;position: absolute; float:left;"><img src="images/loader.gif"></span>
  3.  give wrrapper div: <div id="wrapper">
  4.   give <center> <p>Project Name : <select name="sel_project1" id="sel_project1" onChange="return ShowUnit('show_list',this.value); "> <option value="">Select</option> <?php echo $projectOption; //fetch project list dynamically?> </select></p>
  5.  give responsed :
  6. <div id="show_list">&nbsp;</div>
  7.  close wrapper div : </div>
  8.  Add below code in js file or in between javascript tag

function ShowUnit(div,prid)/*give function name according to your code*/
{
$.ajax({ url: "show_units.php", //type response file name here
 type: "POST", //method get/post
 dataType: "html",
 data :{prid: prid,ar1:$("#sel_area").val(),typ:$("#sel_type").val()} ,
 beforeSend: function (){
 $("#loader").css("display","block");//show loader image
$("#wrapper").css("opacity","0.2");/*set opacity from 1 to 0.2 of wrapper div when loading data or showing loader image*/
 },
 success: function (data, textStatus, xhr){

 $("#"+div).html(data);//get response on given div id
 $("#loader").css("display","none");/*after showing data hide loader image div*/ $("#wrapper").css("opacity","1");/*after showing data set opacity to 1 of wrapper div*/
},
error: function(xhr,textStatus,errorThrown){
 $("#"+div).html(textStatus); }
});
 }

Thursday, January 23, 2014

Add More fields to a form using jquery/javascript in PHP


How can I make a form in php that allows the user to add additional form fields if they need them | Allow to add more fields to form | Inserting multiple form fields with same name | Dynamically Add Input Fields And Submit To Database With jQuery and PHP and fetch values of these fields on updation | Add more input fields to PHP form | Step by step example of add more same fields in PHP

Add More same fields to a form using jquery/javascript in PHP and insert into mysql database and fetch data when update form

 
















Step 1

Add min js in your header or proper location before using javascript code like:-
jquery-1.9.1.min.js OR higher

Step 2

write javascript/jquery code for add fields when click on plus(+) button and remove fields when click on Minus(-) button


Step 3

Add one row of fields between form. You can add more fields according to you


// query for fetch record on update time
$sql_desc="select po_item,po_qty ,po_rate ,po_vat ,po_cst,po_s_tax,po_total from "._DB_PREFIX."po_desc where po_id='$id'";
$qry0=mysql_query($sql_desc);
//end query for fetch record on update time

// query for fetch VAT amount and description for different goods/item
$sql_vat="select tax_amount,description from "._DB_PREFIX."tax where tax_type='VAT' and status='1'";

$qry1=mysql_query($sql_vat);
// end query for fetch VAT amount and description for different

// query for fetch CST amount and description for different goods/item
$sql_cst="select tax_amount,description from "._DB_PREFIX."tax where tax_type='CST' and status='1'";

$qry2=mysql_query($sql_cst);
// end
query for fetch CST amount and description for different
goods/item

// query for fetch service tax amount and description for different goods/item
$sql_ser_tax="select tax_amount,description from "._DB_PREFIX."tax where tax_type='Service Tax' and status='1'";

$qry3=mysql_query($sql_ser_tax);
// end
query for fetch Service Tax amount and description for different
goods/item

 $l=0;
while($row1=mysql_fetch_assoc($qry0)){

$sql_vat="select tax_amount,description from "._DB_PREFIX."tax where tax_type='VAT' and status='1'";
$qry1=mysql_query($sql_vat);

$sql_cst="select tax_amount,description from "._DB_PREFIX."tax where tax_type='CST' and status='1'";
$qry2=mysql_query($sql_cst);

$sql_ser_tax="select tax_amount,description from "._DB_PREFIX."tax where tax_type='Service Tax' and status='1'";
$qry3=mysql_query($sql_ser_tax);

//dynamically draw VAT option in dropdown
$vatOption1='';
while($row_pr_vat=mysql_fetch_assoc($qry1)){
//echo 'gvhfg';
extract($row_pr_vat);

$vatOption1 .= "";
}
// end dynamically draw VAT option in dropdown

//dynamically draw CST option in dropdown
$cstOption1='';

while($row_pr_cst=mysql_fetch_assoc($qry2)){

extract($row_pr_cst);

$cstOption1 .= "";
}

// End dynamically draw CST option in dropdown



//Dynamically draw service tax option in dropdown
$ser_taxOption1='';
while($row_pr_stax=mysql_fetch_assoc($qry3)){

extract($row_pr_stax);

$ser_taxOption1 .= "";
} 
//End dynamically draw service tax option in dropdown list
//for update records

if($id!=''){ ?> <br /> <br /> <label for="p_scnts"><input class="input-type-js input-type2" id="txt_desc_<?php echo $l;?>" name="txt_desc[]" placeholder="Description" size="20" style="width: 145px;" type="text" value="<?php echo $row1['po_item'];?>" /></label><br /> <label for="p_scnts"><input class="input-type-js input-type" id="txt_qty_<?php echo $l;?>" name="txt_qty[]" onkeypress="return isNumber(event)" placeholder="Qty" style="width: 29px;" type="text" value="<?php echo $row1['po_qty'];?>" /></label><br /> <label for="p_scnts"><input class="input-type-js input-type" id="txt_rate_<?php echo $l;?>" name="txt_rate[]" onkeypress="return isNumberKey(this.value);" placeholder="Rate" style="size: 8px;" type="text" value="<?php echo $row1['po_rate'];?>" /></label><br /> <br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_vat_<?php echo $l;?>" name="sel_vat[]"><option value="0.00">VAT</option> echo $vatOption1;?> </select></label><br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_cst_<?php echo $l;?>" name="sel_cst[]"><option value="0.00">CST</option> </select></label><br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_service_tax_<?php echo $l;?>" name="sel_service_tax[]"><option value="0.00">Service Tax</option> </select></label><br /> <label for="p_scnts"><input class="input-type-net input-type" id="txt_total_<?php echo $l;?>" name="txt_total[]" placeholder="Total" readonly="readonly" size="8" type="text" value="<?php echo $row1['po_total'];?>" /></label><br /> <br /> <br /> <br /> <br /> <br /> }
///end update records
else
{ ?>  //for add new fields
<br /> <label for="p_scnts"><input class="input-type-js input-type2" id="txt_desc_0" name="txt_desc[]" placeholder="Description" size="20" style="width: 145px;" type="text" value="" /></label><br /> <label for="p_scnts"><input class="input-type-js input-type" id="txt_qty_0" name="txt_qty[]" onkeypress="return isNumber(event)" placeholder="Qty" style="width: 29px;" type="text" value="" /></label><br /> <label for="p_scnts"><input class="input-type-js input-type" id="txt_rate_0" name="txt_rate[]" onkeypress="return isNumberKey(this.value);" placeholder="Rate" style="size: 8px;" type="text" value="" /></label><br /> <br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_vat_0" name="sel_vat[]" value=""><option value="">VAT</option> </select></label><br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_cst_0" name="sel_cst[]" value=""><option value="">CST</option> </select></label><br /> <label for="p_scnts"><select class="input-type-js input-type" id="sel_service_tax_0" name="sel_service_tax[]" value=""><option value="">Service Tax</option> </select></label><br /> <label for="p_scnts"><input class="input-type-net input-type" id="txt_total_0" name="txt_total[]" placeholder="Total" readonly="readonly" size="8" type="text" value="" /></label><br /> <br /> <br /> <br /> <br />

Wednesday, January 1, 2014

Validate required field in php or server side validation in php if javascript failed by client side


//add this function on function.php or other give other file name you are including on php page

function checkRequiredPost($requiredField) {
    $numRequired = count($requiredField);
    $keys        = array_keys($_POST);
    $allFieldExist  = true;
   
    foreach($requiredField as $reqr)
   
    {
        if($_POST[trim($reqr)]==''){$allFieldExist=false;break;}
    }
   
    return $allFieldExist;
}


// use below code before insert/update  query

$required=array('txt_name','txt_password'); // add fields name you want to mandatory them like name,password etc.

if(isset($_POST['submit']) && checkRequiredPost($required))

{
 ////type your code or insert/update query

}


Friday, December 27, 2013

WRITE PHP CODE IN CKEDITOR SORCE CODE AND FETCH IT ON USER PANEL (FRONT END)

You want to fetch news or other records records in front end(user panel)

                                                       
                                                    while($res=mysql_fetch_array($
qry))    {
                                                    echo ''.  $res['headline'].'....

';
                                                    } ?>




/*write php code in ckeditor use below script on page where you use ckeditor after textarea control*/
   */
            CKEDITOR.replace( 'editor1',
    {
        filebrowserUploadUrl : 'http://127.0.0.1/Hope/admin/images/upload.php'
        //filebrowserUploadUrl : 'http://127.0.0.1/Hope/admin/images/upload.php'
    });

           
-->

//for fetching records to userpanel page  use eval function with below  type or example.

 echo eval('?>' . utf8_encode($rst['content']) . ' //echo $rst['content'];
 

 ?>
 ---------------------------------------