Preventing A Form To Submit If A Field Is Empty

With this code, it alerts the user when the form is empty, but still submits it when the user clicks [OK]

<script type="text/javascript" language="JavaScript">
function nameempty()
        if ( == '' )
                alert('No name was entered!')
                return false;

<form action="submit.php" method="post" name="formname" onsubmit="return nameempty();">
<input type="text" name="name" class="textfield">
<input type="submit" value="Submit" name="submit">

How to detect mobile device using PHP?

by using this script you can detect a mobile device


/* detect mobile device*/
$ismobile = 0;
$container = $_SERVER&#91;'HTTP_USER_AGENT'&#93;;

// A list of mobile devices
$useragents = array (
                'Blazer' ,
                'iPhone' ,
                'iPad' ,
                'Palm' ,
                'Handspring' ,
                'Nokia' ,
                'Samsung' ,
                'Motorola' ,
                'Windows CE' ,
                'Blackberry' ,
                'WAP' ,
                'PlayStation Portable',

foreach ( $useragents as $useragents ) {
    if(strstr($container,$useragents)) {
        $ismobile = 1;
if ( $ismobile == 1 ) {
    //code for mobile devices
}else {
    //code for web

Setting Equal Heights with jQuery

We wrote a script to “equalize” the heights of boxes within the same container and create a tidy grid — with little overhead.

Creating the visual effect of equal-height columns or content boxes has been a challenge ever since we abandoned table-based layouts. When developing complex web applications or site designs we’ve found that it often makes the most sense from a usability and performance standpoint to use a simple JavaScript workaround: our equalHeights() function determines the heights of all sibling elements in a container, and then sets each element’s minimum height to that of the tallest element. When JavaScript is disabled, the boxes or columns appear with varying heights, but the content remains legible and the page is still completely usable.

BigDump: Staggered MySQL Dump Importer

Staggered import of large and very large MySQL Dumps (like phpMyAdmin 2.x Dumps) even through the web servers with hard runtime limit and those in safe mode. The script executes only a small part of the huge dump and restarts itself. The next session starts where the last was stopped.

download it from here
Script site :

Using PHP/MySQL with Google Maps

This tutorial is intended for developers who are familiar with PHP/MySQL, and want to learn how to use Google Maps with a MySQL database. After completing this tutorial, you will have a Google Map based off a database of places. The map will differentiate between two types of places—restaurants and bars—by giving their markers distinguishing icons. An info window with name and address information will display above a marker when clicked.

The tutorial is broken up into the following steps:
+ Creating the table
+ Populating the table
+ Outputting XML with PHP
+ Creating the map

Create a Back Button

The basic code for a back button link is a very simple JavaScript. All you have to do with this back button JavaScript is copy the code and paste it where you want the back button link to show on your Web page.

<a href="javascript:history.go(-1)">Go Back</a>


PNG-Transparency for Windows IE 5.5 & 6

This plugin will fix the missing PNG-Transparency in Windows Internet Explorer 5.5 & 6.

Version 1.1, 2007-09-11

Tested on Windows XP SP2 with
– IE 5.5 + 6 + 7


* unobtrusive script, simple to setup
* works now also with CSS-Backgrounds (but scaling backgrounds)
* works with PNG-Images within Links
* TITLE, ALT, CLASS and STYLE-Attributes are considered

Name and Email auto hide/show

To make Name and Email auto hide/show like this:

use this code:

<form method="post" name="Dateform">
  <input  name="nameTrip" value="Name" onfocus="if(this.value == 'Name') this.value =''" onblur="if (this.value == '') this.value='Name'" type="text">
  <input  name="emailTrip" value="E-mail" onfocus="if(this.value == 'E-mail') this.value =''" onblur="if (this.value=='') this.value='E-mail'" type="text">
  <textarea autocomplete="off"  name="textarea" onfocus="if(this.value == 'Details') this.value =''" onblur="if (this.value=='') this.value='Details'">Details</textarea>

Bookmark your site

Step 1: Add the below code to the section of your page:

<script type="text/javascript">

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
else if(document.all)// ie
	window.external.AddFavorite(url, title);

Step 2: Create either an image or text link that will be used as the Bookmark Site link. For the href attribute, use the following code:

<a href="javascript:bookmarksite('Site Nmae', '')">Bookmark this site!</a>