Monday, 11 February 2013

JQuery: Ajax Example of Select Values Filled Dynamically


Make Dynamic Select Box using Ajax, Jquery, Php, MySql.
First Choose country from Select Box of country after that pull data from database using Ajax, Jquery and show data other Select box of city without page refresh.
Requirements:
1)index.php
2)city.php
3)tables in a database.
  • country
  • city
Two tables are required
index.php
________________________________________________________________________________
java script code
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“.country”).change(function(){
$id = $(this).val();
$.ajax({
type:”Post”,
url:”city.php”,
data:”id=”+$id,
cache:”false”,
success:function(html){
$(“#city”).html(html);
}
});
});
});
</script>
Php code
<div class=”label”>Country</div>
<select class=”country”>
<option selected=”selected”>Select Country</option>
<?php
include(“config.php”);
$sql = “select * from country” or die(“query error”);
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
$id = $rows['id'];
$country = $rows['country'];
echo ‘<option value=”‘.$id.’”>’.$country.’</option>’;
}
?>
</select>
Html code
<div class=”label”>City</div>
<select id=”city”>
<option value=”"<Select Country first</option>
</select>
________________________________________________________________________________

City.php

_________________________________________________________________________________

<?php
include(“config.php”);
$sql = “select id,city from city where country_id=”.$_POST['id'] or die(“query error”);
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result)){
$cityid= $rows['id'];
$cityname = $rows['city'];
echo ‘<option id=”‘.$cityid.’”>’.$cityname.’</option>’;
}
?>
__________________________________________________________________________________________



Wednesday, 2 January 2013

Designing A Navigation using Jquery

Step 1)
Create a html page and name it as "test1.html"
here goes our code


<html>
<head>
<title>Example 1</title>
</head>
<body>
<ul id="navigation">
<li id="home"><a href="#">Home</a></li>
<li class="active"><a href="#">about us</a></li>
<li><a href="#">Our Vision</a></li>
<li><a href="#">Blogs</a></li>
</ul>
<div id="placeHolder">
<!-- our content displyed in this div area -->
</div>
<script src=js/jquery.min.js></"></script>
<script>
$(document).ready(function(){
$('#navigation li a').each(function(){
var $item = $(this);
$item.bind('click',function(event){
event.preventDefault();
var title = $item.html();
var html = title + ' was selected.';
$('#placeHolder').html(html);
});
});
});

Step 2) you need to get a Jquery file i.e., jquery.min.js you can download it from http://code.jquery.com/jquery-1.7.1.min.js and put it in "js" folder
<script src=js/jquery.min.js></"></script>

Demo Here

Create Agile Web application using PHP Ajax and Jquery

I will publish a series of blog posts for creating responsive Web applications using PHP AJAX and JQuery
and with this series of posts you will be able understand how we can use these Technologies to create Responsive web application moreover you will be able use it in Development.

Sunday, 5 August 2012

PHP isset() function

isset — Determine if a variable is set and is not NULL


isset() determines whether a certain variable has already been declared by PHP. It returns a boolean value true if the variable has already been set, and false otherwise, or if the variable is set to the value NULL.

Example #1 isset() Examples
<?php

$var 
= '';// This will evaluate to TRUE so the text will be printed.if (isset($var)) {
    echo 
"This var is set so I will print.";
}
// In the next examples we'll use var_dump to output
// the return value of isset().
$a = "test";$b = "anothertest";var_dump(isset($a));      // TRUE

var_dump(isset($a, $b)); // TRUEunset ($a);var_dump(isset($a));     // FALSE
var_dump(isset($a, $b)); // FALSE$foo = NULL;var_dump(isset($foo));   // FALSE?>

Thursday, 5 July 2012

php Event Calendar

phpEventCalendar is a MySQL backed application that allows users to post and display events or notes on a month-at-a-glance calendar. A user administration panel allows authorized users (Administrators) to control who can add, delete, and edit events (Editors). 

Features:

  • Script renders a month-at-a-glance calendar that displays events that have been added by a calendar administator or editor.
  • User administration panel.
  • There are two user levels. Administrators can add/edit users, and add/edit any and all events. Editors can add events, edit their own events, and change their password.
  • Adjustable weekstart. The calendar can be set to display any day of the week as the first column in the calendar.
  • Displays in two time formats, a 12 hour format that displays 12:00am to 12:00pm, and a 24 hour format that displays 00:00-23:59.
  • Calendar colors and size customizable through css file
  • Simple template file makes it easy for people with little php knowledge to integrate the calendar in their site.
  • Ability to limit the maximum number of posts, and the maximum number of characters per event, that are displayed on the month-at-a-glance calendar.
Demo       :http://www.phpcodeworks.com/scripts/pec/demo
website    : http://www.phpcodeworks.com

Monday, 2 July 2012

Vector Maps With jQuery, Vector Graphic Maps for Modern Browsers :JQVMAP


JQVMap is a jQuery plugin for render vector graphic maps by using SVG for modern browsers and VML for the rest.
It is a heavily modified version of another plugin, jVectorMap, and comes withready-to-use maps of “world, USA, Europe and Germany”.
There are several customization options for beautifying the maps including colors, borders or their opacity.
Maps can have zooming enabled or not, show tooltips of data when hovered and there is callback for clicks.

Also, it is possible to select any regions on initial load or after any custom event.

Requirements: jQuery
Compatibility: All Modern Browsers
Website: http://jqvmap.com/
Download: https://github.com/manifestinteractive/jqvmap


PHP Image Gallery

PhotoShow is a free, open-source, PHP application and  very easy to use web image gallery installable on any web server.
The application works without a database and uses the folder structure for creating the hierarchy of the galleries (supports unlimited sub-galleries).
Images can be added either from the admin panel via a drag ‘n’ drop uploader or directly from the filesystem. Organizing the folders/images, editing and deleting them are also accomplished with the same methods.


There is support for multiple users and groups where each can have different permissions.
PhotoShow can auto-generate thumbnails of images, display the EXIF data and allows others to comment them.

Search Engine Submission - AddMe