PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari   zquery   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: index example
Class: zquery
Process interaction requests using jQuery
Author: By
Last change: improvements and new features
Date: 14 years ago
Size: 2,590 bytes
 

Contents

Class file image Download
<?php session_start();
// set some session var for testing (debugging)
$_SESSION['foo'] = 'bar';

// you understand this....
require_once('inc.zquery.class.php');

// initiate the class
$zq = new zquery;

$zq->write_jquery();
?>
<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:13px;}
</style>
<h2>zquery version 1.3.2 (implements jquery 1.3.2)</h2>
<h3>Example sending $_POST data:</h3>
<form action="" method="post" id="testform" name="testform">
            <p>
                <label for="name">Name:</label><br />
                <input type="text" name="name" id="name" size="25" />
  </p>
            <p>
                <label for="email">Email:</label><br />
                <input type="text" name="email" id="email" size="25" />
              <input name="postit" type="hidden" id="postit" value="1" />
            </p>
            <p>
            <span id="zqDisplay"></span>
            <!--Submit the form through ajax; 1st argument is the .php file for processing, 2nd argument is the id of the form, 3rd argument (optional) is the question wil be asked -->
                <input type="button" name="subx" id="subx" value="Subscribe" onclick="<? $zq->zpost('process.php','testform')?>"/>
            </p><!--Submit the data through ajax; 1st argument is the .php file for processing with query string, 2nd argument (optional) is the question wil be asked -->
            <h3>Example sending $_GET data: <a href="javascript: void(0);" onclick="<? $zq->zget('process.php?delete=true&piece_id=2010','Keep going deleting?')?>">send me</a></h3>

</form>
<h3>Example sending $_POST data that will be shown under the form: </h3>
<form action="" method="post" id="testform1" name="testform1">
            <p>
                <label for="name">Name:</label><br />
                <input type="text" name="name" id="name" size="25" />
  </p>
            <p>
                <label for="email">Email:</label><br />
                <input type="text" name="email" id="email" size="25" />
              <input name="postit" type="hidden" id="postit" value="1" />
            </p>
            <p>
            <!--Submit the form through ajax; 1st argument is the .php file for processing, 2nd argument is the id of the form, 3rd argument is the tag id where data is shown, 4th (optional) is the asked question -->
              <input type="button" name="suby" id="suby" value="Subscribe" onclick="<? $zq->zpost_and_show('postandshow.php','testform1','zqDisplay1')?>"/>
            </p>
            <h3>Example sending $_GET data that will be shown under the form: <a href="javascript: void(0);" onclick="<? $zq->zget_and_show('getandshow.php?delete=true&piece_id=2010','zqDisplay1','Keep going deleting?')?>">send me</a></h3>
</form>
<div id="zqDisplay1"></div>