Jquery links:It's very easy to apply jquery

css tips:

Http://forums.devarticles.com/javascript-development-22/auto-refresh-parent-window-after-closing-popup-4864.html

http://www.instantshift.com/2010/03/15/47-css-tips-tricks-to-take-your-site-to-the-next-level/

dropdownmenu

http://www.lwis.net/free-css-drop-down-menu/


jquery

http://visionwidget.com/inspiration/web/295-jquery-content-sliders.html
http://www.malsup.com/jquery/corner/
http://blueprintds.com/2009/01/20/top-14-jquery-photo-slideshow-gallery-plugins/
http://spaceforaname.com/gallery-light.html



http://nettuts.s3.amazonaws.com/078_screencast2/jFlowTutorial/index.htm
http://demo.webdeveloperplus.com/featured-content-slider/
http://cssglobe.com/lab/easyslider1.5/04.html
http://nettuts.s3.amazonaws.com/377_slider/slider_sourcefiles/slider.html

Most attractive
http://css-tricks.com/examples/StartStopSlider/
http://devthought.com/wp-content/projects/mootools/barackslideshow/Demo/

HTML Layout

http://cssglobe.com/post/1415/3-simple-steps-in-coding-a-rounded-corners-layout

More Jquery
http://www.smashingmagazine.com/2009/01/15/45-new-jquery-techniques-for-a-good-user-experience/

Animated Button in Jquery
http://apycom.com/

Error messge in php

Step 1: registration.php
lt;?PHP
if($_REQUEST['err']) {?gt;
lt;br /gt;
lt;div style="border:1px solid red;text-align:center;width:400px;margin:auto;color:red;"gt;
lt;?php echo $error=$_REQUEST['err']; ?gt;
lt;/divgt;

lt;?php } ?gt;

lt;?PHP
if($_REQUEST['succes']) {?gt;
lt;br /gt;
lt;div style="border:1px solid red;text-align:center;width:400px;margin:auto;color:red;"gt;
lt;?php echo $succes=$_REQUEST['succes']; ?gt;
lt;/divgt;

lt;?php } ?gt;

lt;/brgt;

lt;htmlgt;
lt;headgt;
lt;/headgt;
lt;bodygt;
lt;form action="registration_action.php" method="post"gt;
lt;centergt;
lt;divgt;
lt;font size=5gt;USER REGISTRATIONlt;/fontgt;
lt;brgt;
lt;font size=1gt;lt;supgt;*lt;/supgt; Required Fieldslt;/fontgt;
lt;brgt;
lt;input type="hidden" name="id"gt;
lt;brgt;
lt;bgt;First Namelt;supgt;*lt;/supgt;lt;/bgt;

lt;input type="text" name="firstName" size=15 maxlength=20gt;
lt;brgt;
lt;brgt;
lt;bgt;Last Namelt;supgt;*lt;/supgt;lt;/bgt;

lt;input type="text" name="lastName" size=15 maxlength=20gt;

lt;brgt;
lt;brgt;
lt;bgt;User Namelt;supgt;*lt;/supgt;lt;/bgt;

lt;input type="text" name="userName" size=15 maxlength=20gt;
lt;brgt;
lt;brgt;
lt;bgt;Passwordlt;supgt;*lt;/supgt;lt;/bgt;

lt;input type="password" name="password1" size=15 maxlength=20 style="margin-left:10px;"gt;
lt;brgt;
lt;brgt;
lt;bgt;Confirm Passwordlt;supgt;*lt;/supgt;lt;/bgt;
lt;input type="password" name="password2" size=15 maxlength=20gt;
lt;brgt;
lt;brgt;


lt;bgt;What music are you interested in?lt;/bgt;
lt;brgt;
lt;input type="checkbox" name="faveMusic[]"
value="Rock"gt;Rock
lt;input type="checkbox" name="faveMusic[]" value="Pop"gt;Pop
lt;input type="checkbox" name="faveMusic[]" value="Bluegrass"gt;Bluegrasslt;brgt;
lt;input type="checkbox" name="faveMusic[]" value="Blues"gt;Blues
lt;input type="checkbox" name="faveMusic[]" value="Jazz"gt;Jazz
lt;input type="checkbox" name="faveMusic[]" value="Country"gt;Countrylt;brgt;



lt;bgt;What u are?lt;/bgt;
lt;brgt;
lt;input type="radio" name="male_female" value="Male" checkedgt;Male

lt;input type="radio" name="male_female" value="Female" gt; Female
lt;brgt;
lt;brgt;
lt;input type="submit" name="submit" value="Submit"gt;
lt;input type="reset" value="Reset"gt;
lt;/divgt;

lt;/centergt;
lt;/formgt;

lt;/bodygt;
lt;/htmlgt;


Step 2. registration.php


lt;?php
if(isset($_REQUEST['submit']))
{
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("registration") or die (mysql_error());


// Variable Section

$firstName=$_REQUEST['firstName'];
$lastName=$_REQUEST['lastName'];
$userName=$_REQUEST['userName'];
$password1=$_REQUEST['password1'];
$password2=md5($_REQUEST['password2']);
$faveMusic=$_REQUEST['faveMusic'];
$male_female=$_REQUEST['male_female'];

//Error Message
if(empty($firstName))
{
echo $error="Firstname Cannot be Empty";
}

else if(empty($lastName))
{
echo $error="Lastname Cannot Be Empty";
}

else if(empty($password1))
{
echo $error="Password Cannot Be Empty";
}
else if(empty($password2))
{
echo $error="Confirm Password Cannot Be Empty";
}

else if(empty($faveMusic))
{
echo $error="Music Cannot Be Empty";
}

else if(empty($male_female))
{
echo $error="male /female Cannot Be Empty";
}





if ($error==NULL)
{
//transfer to Mutliple Data in check box
$data="";
$data=implode("",$faveMusic);
$sql="INSERT into tbl_registration

VALUES

('','$firstName','$lastName','$email','$userName','$password1','$password2','$data','$male_female)";
$result=mysql_query($sql);
if($result)
{
$succes="Successfully inserted";
header("location:login.php");
}

?gt;


lt;body onLoad="document.form.submit();"gt;
lt;form name="form" method="post" action="registration.php?&succes=lt;?php echo $succes;?gt;"gt;
lt;/formgt;
lt;/bodygt;


lt;?php
}else{
?gt;
lt;body onLoad="document.form.submit();"gt;
lt;form name="form" method="post" action="registration.php?&err=lt;?php echo $error;?gt;"gt;
lt;/formgt;
lt;/bodygt;
lt;?php
}
}
?gt;

Registration,login & Email validation in php

Step 1: insert.php

lt;?php
session_start();
echo $_SESSION['UNAME'];

?gt;


lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"gt;
lt;html xmlns="http://www.w3.org/1999/xhtml"gt;
lt;headgt;
lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /gt;
lt;titlegt;Untitled Documentlt;/titlegt;

lt;bodygt;

lt;?php echo $_REQUEST['err']; ?gt;
lt;table width="300" border="1" align="center" cellpadding="0" cellspacing="1"gt;
lt;trgt;
lt;tdgt;lt;form name="form1" method="post" action="insert_action.php" gt;
lt;table width="100%" border="0" cellspacing="1" cellpadding="3"gt;
lt;trgt;
lt;td colspan="3" align="center"gt;lt;stronggt;Registrationlt;/stronggt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td colspan="3" align="center"gt;lt;stronggt;
lt;?php
if($_SESSION['UNAME'])
{
?gt;
lt;a href="logout.php"gt;Logoutlt;/stronggt;lt;/agt;
lt;?php
}
else
{
?gt;
lt;a href="login.php"gt;Loginlt;/stronggt;lt;/agt;
lt;?php
}
?gt;


lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td width="71"gt;Namelt;/tdgt;
lt;td width="6"gt;:lt;/tdgt;
lt;td width="301"gt;lt;input name="name" type="text" id="name"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Lastnamelt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="lastname" type="text" id="lastname"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Emaillt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="email" type="text" id="email" gt;lt;/tdgt;
lt;/trgt;

lt;trgt;
lt;td colspan="3" align="center"gt;lt;input type="submit" name="Submit" value="Submit"gt;lt;/tdgt;
lt;/trgt;

lt;/tablegt;
lt;/formgt;
lt;/tdgt;
lt;/trgt;
lt;/tablegt;
lt;/bodygt;
lt;/htmlgt;



Step 2: insert_action.php
lt;?php
include("connect.php");

// get values from from

function isValidEmail($email){
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";

if (eregi($pattern, $email)){
return true;
}
else {
return false;
}
}


if ($_POST['Submit'])
{

$name=$_POST['name'];
$lastname=$_POST['lastname'];
$email= $_REQUEST['email'];


if(!isValidEmail($email))
{
$err = "Invalid Email";

}

if($err==NULL)
{

$sql="INSERT INTO test_mysql(name,lastname,email)VALUES ( '$name','$lastname', '$email')";
$result=mysql_query($sql);
}
else

{
?gt;
lt;body onload="insertform.submit();"gt;
lt;form name="insertform" method="post" action="insert.php"gt;
lt;input type="hidden" name="err" value="lt;?php echo $err; ?gt;"
lt;/formgt;
lt;/bodygt;
lt;?php

}

}

// Insert data into mysql
if($result)
{
echo "Congratulations!Please login ";
echo "lt;BRgt;";
echo "lt;a href='login.php'gt;loginlt;/agt;";
echo "lt;BRgt;";

echo "lt;a href='list_records.php'gt;Click here to edit/deletelt;/agt;";
}


/*
{
echo "sorry ! U are not succesful";
}*/
mysql_close();
?gt;


Step 3: login.php


lt;htmlgt;
lt;bodygt;
lt;table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"gt;
lt;trgt;
lt;form name="form1" method="post" action="login_action.php"gt;
lt;tdgt;
lt;table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"gt;
lt;trgt;
lt;td colspan="3"gt;lt;stronggt;Member Login lt;/stronggt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td width="78"gt;namelt;/tdgt;
lt;td width="6"gt;:lt;/tdgt;
lt;td width="294"gt;lt;input name="uname" type="text" id="name"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Emaillt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="email" type="text" id="email"gt;lt;/tdgt;

lt;/trgt;
lt;trgt;
lt;tdgt; lt;/tdgt;
lt;tdgt; lt;/tdgt;
lt;tdgt;lt;input type="submit" name="Submit" value="Login"gt;lt;/tdgt;
lt;/trgt;
lt;/tablegt;
lt;/tdgt;
lt;/formgt;
lt;/trgt;
lt;/tablegt;
lt;/bodygt;
lt;/htmlgt;


Step 4: login_action.php


lt;?php
session_start();
include("connect.php");


// get value from from
$name=$_REQUEST['uname'];
$email=$_REQUEST['email'];
$id=$_REQUEST['id'];

/// To protect MySQL injection (more detail about MySQL injection)
$name = stripslashes($name);
$email = stripslashes($email);
$name = mysql_real_escape_string($name);
$email = mysql_real_escape_string($email);


$sql="SELECT * FROM test_mysql where name='$name' and email='$email' ";
$rs=mysql_query($sql);

$result = mysql_fetch_array($rs);

echo $result['name'];
echo $result['email'];

if($result['name']==$name && $result['email']==$email)
{


$_SESSION['UNAME']=$name;

header("location:list_records.php");

}
else
echo "Wrong Username or Password";






//$count=mysql_num_rows($result);
//if($count==1)
//{
//session_register='$name';
//session_register='$email';
//header:"location:success.php";

//}


//else {
//echo "Wrong Username or Password";
//}

?gt;

Session concept in php

Step 1:Session concept in php


lt;?php
session_start();
echo $_SESSION['UNAME'];
// This function tests whether the email address is valid

?gt;
lt;?php
function isValidEmail($email){
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";

if (eregi($pattern, $email)){
return true;
}
else {
return false;
}
}
?gt;
lt;?php
if ($_POST['Submit'])
{

$emial= $_REQUEST['email'];

if(!isValidEmail($emial))
{
$err = "Invalid Email";

}


if (isValidEmail($_POST['email'])){
echo "lt;trgt;lt;tdgt;The email: ".$_POST['email']." is valid!lt;/tdgt;lt;/trgt;";
}
else{
echo "lt;trgt;lt;tdgt;The email: ".$_POST['email']." is invalid!lt;/tdgt;lt;/trgt;";
}
}
?gt;

lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"gt;
lt;html xmlns="http://www.w3.org/1999/xhtml"gt;
lt;headgt;
lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /gt;
lt;titlegt;Untitled Documentlt;/titlegt;

lt;bodygt;

lt;?php echo $err; ?gt;
lt;table width="300" border="1" align="center" cellpadding="0" cellspacing="1"gt;
lt;trgt;
lt;tdgt;lt;form name="form1" method="post" action="insert_action.php" gt;
lt;table width="100%" border="0" cellspacing="1" cellpadding="3"gt;
lt;trgt;
lt;td colspan="3" align="center"gt;lt;stronggt;Registrationlt;/stronggt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td colspan="3" align="center"gt;lt;stronggt;
lt;?php
if($_SESSION['UNAME'])
{
?gt;
lt;a href="logout.php"gt;Logoutlt;/stronggt;lt;/agt;
lt;?php
}
else
{
?gt;
lt;a href="login.php"gt;Loginlt;/stronggt;lt;/agt;
lt;?php
}
?gt;


lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td width="71"gt;Namelt;/tdgt;
lt;td width="6"gt;:lt;/tdgt;
lt;td width="301"gt;lt;input name="name" type="text" id="name"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Lastnamelt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="lastname" type="text" id="lastname"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Emaillt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="email" type="text" id="email" gt;lt;/tdgt;
lt;/trgt;

lt;trgt;
lt;td colspan="3" align="center"gt;lt;input type="submit" name="Submit" value="Submit"gt;lt;/tdgt;
lt;/trgt;

lt;/tablegt;
lt;/formgt;
lt;/tdgt;
lt;/trgt;
lt;/tablegt;
lt;/bodygt;
lt;/htmlgt;


Step 2:Session concept in php

lt;?php
include("connect.php");

// get values from from

$name=$_POST['name'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];



// Insert data into mysql
$sql="INSERT INTO test_mysql(name,lastname,email)VALUES ( '$name','$lastname', '$email')";
$result=mysql_query($sql);
if($result)
{
echo "Congratulations!Please login ";
echo "lt;BRgt;";
echo "lt;a href='login.php'gt;loginlt;/agt;";
echo "lt;BRgt;";

echo "lt;a href='list_records.php'gt;Click here to edit/deletelt;/agt;";
}


/*
{
echo "sorry ! U are not succesful";
}*/
mysql_close();
?gt;

Step 3:Session concept in php

lt;htmlgt;
lt;bodygt;
lt;table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"gt;
lt;trgt;
lt;form name="form1" method="post" action="login_action.php"gt;
lt;tdgt;
lt;table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"gt;
lt;trgt;
lt;td colspan="3"gt;lt;stronggt;Member Login lt;/stronggt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;td width="78"gt;namelt;/tdgt;
lt;td width="6"gt;:lt;/tdgt;
lt;td width="294"gt;lt;input name="uname" type="text" id="name"gt;lt;/tdgt;
lt;/trgt;
lt;trgt;
lt;tdgt;Emaillt;/tdgt;
lt;tdgt;:lt;/tdgt;
lt;tdgt;lt;input name="email" type="text" id="email"gt;lt;/tdgt;

lt;/trgt;
lt;trgt;
lt;tdgt; lt;/tdgt;
lt;tdgt; lt;/tdgt;
lt;tdgt;lt;input type="submit" name="Submit" value="Login"gt;lt;/tdgt;
lt;/trgt;
lt;/tablegt;
lt;/tdgt;
lt;/formgt;
lt;/trgt;
lt;/tablegt;
lt;/bodygt;
lt;/htmlgt;


Step 4:Session concept in php


lt;?php
session_start();
include("connect.php");


// get value from from
$name=$_REQUEST['uname'];
$email=$_REQUEST['email'];
$id=$_REQUEST['id'];

/// To protect MySQL injection (more detail about MySQL injection)
$name = stripslashes($name);
$email = stripslashes($email);
$name = mysql_real_escape_string($name);
$email = mysql_real_escape_string($email);


$sql="SELECT * FROM test_mysql where name='$name' and email='$email' ";
$rs=mysql_query($sql);

$result = mysql_fetch_array($rs);

echo $result['name'];
echo $result['email'];

if($result['name']==$name && $result['email']==$email)
{


$_SESSION['UNAME']=$name;

header("location:list_records.php");

}
else
echo "Wrong Username or Password";






//$count=mysql_num_rows($result);
//if($count==1)
//{
//session_register='$name';
//session_register='$email';
//header:"location:success.php";

//}


//else {
//echo "Wrong Username or Password";
//}

?gt;


Step 5:Session concept in php


lt;?php
session_start();
echo $_SESSION['UNAME'];
include("connect.php");
//select query
$result = mysql_query("SELECT * FROM test_mysql");

?gt;
lt;table width="400" border="0" cellspacing="1" cellpadding="0"gt;
lt;trgt;
lt;tdgt;
lt;table width="400" border="1" cellspacing="0" cellpadding="3"gt;
lt;trgt;
lt;td colspan="4"gt;lt;stronggt;List data from mysql lt;/stronggt; lt;/tdgt;
lt;/trgt;
lt;?php
if($_SESSION['UNAME'])
{
?gt;
lt;a href="logout.php"gt;Logoutlt;/stronggt;lt;/agt;
lt;?php
}
else
{
?gt;
lt;a href="login.php"gt;Loginlt;/stronggt;lt;/agt;
lt;?php
}
?gt;
lt;trgt;
lt;td align="center"gt;lt;stronggt;Namelt;/stronggt;lt;/tdgt;
lt;td align="center"gt;lt;stronggt;Lastnamelt;/stronggt;lt;/tdgt;
lt;td align="center"gt;lt;stronggt;Emaillt;/stronggt;lt;/tdgt;
lt;td align="center"gt;lt;stronggt;Updatelt;/stronggt;lt;/tdgt;
lt;td align="center"gt;lt;stronggt;Deletelt;/stronggt;lt;/tdgt;
lt;/trgt;
lt;?php
while($rows=mysql_fetch_array($result)){
?gt;
lt;trgt;
lt;tdgt;lt;?php echo $rows['name']; ?gt;lt;/tdgt;
lt;tdgt;lt;?php echo $rows['lastname']; ?gt;lt;/tdgt;
lt;tdgt;lt;?php echo $rows['email']; ?gt;lt;/tdgt;
lt;td align="center"gt;lt;a href="update.php?id=lt;?php echo $rows['id']; ?gt;"gt;updatelt;/agt;lt;/tdgt;
lt;td align="center"gt;lt;a href="delete.php?id=lt;?php echo $rows['id']; ?gt;"gt;deletelt;/agt;lt;/tdgt;

lt;/trgt;
lt;?php
}
?gt;
lt;/tablegt;
lt;/tdgt;
lt;/trgt;
lt;/tablegt;
lt;?php
mysql_close();
?gt;


Pagination in php

form.php


lt?php
$ColorID = "";
if(!empty($_REQUEST['ID'])) $ColorID = $_REQUEST['ID'];

if(!empty($_REQUEST['ID']))
{
$title = "EDIT COLOR";
$button = "Update";
$closeButton = "javascript:window.close();";

$query = " SELECT * FROM colors WHERE ColorID = '{$_REQUEST['ID']}' ";
$colorPacket = SelectQuery($query);
$thisColorPacket = $colorPacket[0];
}
else
{
$title = "ADD COLOR";
$button = "Insert";
$closeButton = "javascript:history.back();";
}

// variable default section
$colorCode = '';
if(!empty($thisColorPacket['ColorCode'])) $colorCode = $thisColorPacket['ColorCode'];
if(!empty($_REQUEST['colorCode'])) $colorCode = $_REQUEST["colorCode"];
$publish = '';
if(!empty($thisColorPacket['IsActive'])) $publish = $thisColorPacket['IsActive'];
if(!empty($_REQUEST['publish'])) $publish = $_REQUEST["publish"];


// Set the error flags section
if(empty($error)) $error = false;
if(empty($errorMessage)) $errorMessage="";

if(empty($colorCodeError)) $colorCodeError=false;
?gt
ltdiv align="center"gt
lt?php if($error && $errorMessage!=""){?gt
ltdiv class="erroMessage"gt
ltulgt
lt?php print " {$errorMessage}";?gt
lt/ulgt
lt/divgt
lt?php }?gt
lt!-- Build the interface --gt
ltform name="oColorInsertUpdateForm" action="lt?php echo $_SERVER['SCRIPT_NAME'];?gt?skin=admin&area=lt?php echo $_REQUEST['area']; ?gt&action=color-action" method="post"gt
ltfieldset class="fieldDesign3"gt
ltlegend class="legendDesign"gtlt?php echo $title;?gtlt/legendgt
lttable width="0" border="0" cellpadding="4" cellspacing="4" class="formtable"gt
lt?php
if(!empty($_REQUEST['message']))
{
print"
lttr valign=\"top\"gtlttd align=\"center\" colspan=\"2\" style=\"font-weight:bold;color:orange;\"gt{$_REQUEST['message']}
";
}
?gt


lt?php


// the interface for sitefontFamilyName
if($colorCodeError)
{
print "

lttrgtlttd style='color: red;'gtColor Codelt/tdgt
";
}
else
{
print "lttrgtlttdgtColor Codelt/tdgt";
}
print "lttdgtltinput name='colorCode' value='{$colorCode}' type='text' size='60' class='inputText2'gtltspan style='color:red;'gt*lt/spangtlt/tdgtlt/trgt";
?gt
lttrgt
lttdgtPublishlt/tdgt
lttdgt
ltselect name="publish" style="width:70px;" class='inputText2'gt
ltoption value="1" lt?php if($publish == 1) echo "Selected"; ?gtgtEnablelt/optiongt
ltoption value="0" lt?php if($publish == 0) echo "Selected"; ?gtgtDisablelt/optiongt
lt/selectgt
ltspan style="color:red;"gt*lt/spangt
lt/tdgt
lt/trgt
lt!-- the interface for insert, reset or cancel button --gt
lttr height="2"gtlttd colspan="2"gt lt/tdgtlt/trgt
lttrgt
lttdgt lt/tdgt
lttdgt
ltinput name="btnlt?php echo $button;?gt" type="submit" value="lt?php echo $button;?gt" class="inputBtn2"gt
ltinput name="btnReset" type="Reset" class="inputBtn2"gt
ltinput name="btnCancel" type="button" value="Cancel" onclick="lt?php echo $closeButton; ?gt" class="inputBtn2"gt
ltinput type="hidden" name="ID" value="lt?php echo $ColorID;?gt"gt
lt/tdgt
lt/trgt
lt/tablegt
lt/fieldset gt
lt/formgt
lt/divgt





2. select.php


lt?php
/* Set Default Variable */
if (empty($_REQUEST["startValue"])) $_REQUEST["startValue"] = 0;
if (empty($_REQUEST["limitValue"])) $_REQUEST["limitValue"] = 20;
if (empty($_REQUEST["OrderBy"])) $_REQUEST["OrderBy"] = "UserID";
if (empty($_REQUEST["Order"])) $_REQUEST["Order"] = "ASC";
if (empty($_REQUEST["publish"])) $_REQUEST["publish"] = "";


$colorCode = "";
if(!empty($_REQUEST['colorCode'])) $colorCode = $_REQUEST['colorCode'];
$publish = "";
if(!empty($_REQUEST['publish'])) $publish = $_REQUEST['publish'];

?gt

ltpgtltstronggt COLOR MANAGERlt/stronggtlt/pgt
lt!-- Starting the search interface --gt
ltform name="oColorCodeSearchForm" method="post" action="lt?php echo $_SERVER['SCRIPT_NAME']; ?gt?skin=admin&area=lt?php echo $_REQUEST['area']; ?gt&action=lt?php echo $_REQUEST['action']; ?gt"gt
ltpgtPlease select the desired options and press listlt/pgt
lttable width="100%" cellpadding="4" cellspacing="0" class="borderStyle" gt
lttr valign="top"gt
lttdgt
Color Code  
ltinput name="colorCode" value="lt?php echo $colorCode;?gt" type="text" class="inputText2"gt
lt/tdgt
lttdgt
Publish  
ltselect name="publish" class="inputText2"gt
ltoption value="" lt?php if(empty($publish)) echo "Selected";?gtgt lt/optiongt
ltoption value="1" lt?php if($publish == '1') echo "Selected";?gtgtEnablelt/optiongt
ltoption value="0" lt?php if($publish == '0') echo "Selected";?gtgtDisablelt/optiongt
lt/selectgt
lt/tdgt
lttd valign="middle"gt
Records Per Page lt/tdgt
lttd valign="middle"gt
ltselect name="limitValue" class="inputText2"gt
ltoption value="20" lt?php if($_REQUEST['limitValue'] == 20) echo "Selected";?gtgt20lt/optiongt
ltoption value="50" lt?php if($_REQUEST['limitValue'] == 50) echo "Selected";?gtgt50lt/optiongt
ltoption value="100" lt?php if($_REQUEST['limitValue'] == 100) echo "Selected";?gtgt100lt/optiongt
ltoption value="500" lt?php if($_REQUEST['limitValue'] == 500) echo "Selected";?gtgt500lt/optiongt
ltoption value="1000" lt?php if($_REQUEST['limitValue'] == 1000) echo "Selected";?gtgt1000lt/optiongt
lt/selectgt
lt/tdgt
lttd align="right"gtltinput type="Submit" name="btnSubmit" value="View List" class="inputBtn2"gt
lt/tdgt
lt/trgt
lt/tablegt
lt/formgt

lt!-- Do the search only if search button was clicked or show the entire list --gt
lt?php
if(!empty($_REQUEST['btnSubmit']) or true)
{
$query = " SELECT * FROM colors WHERE TRUE ";
if(!empty($_REQUEST['colorCode'])) $query.=" AND LOWER(ColorCode) LIKE LOWER('%{$_REQUEST['colorCode']}%') ";
if(!empty($_REQUEST['publish'])) $query.=" AND IsActive = {$_REQUEST['publish']} ";
$query.=" ORDER BY ColorID ";
//print $query;

$dataPacket = SelectQuery($query);
// Display the record
if($dataPacket != 0)
{
$records=count($dataPacket);
//print $records;
print "
lttable width='100%' border='0' cellspacing='2' cellpadding='4' class='borderStyle' bgcolor='#ffffff'gt
lttr valign='top'gt
lttd colspan='5'gt
lttable width='100%' cellspacing='0' cellpadding='0'gt
lttrgt
lttd align='left'gtList of Record(s)lt/tdgt
lttd align='right'gtTotal of ltstronggt{$records}lt/stronggt record(s) found.lt/tdgt
lt/trgt
lt/tablegt
lt/tdgt
lt/trgt
lttrgt
lttd colspan=4gtlt/tdgtlttd class='main_menu'gt
lta href='{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-form'gtADD NEWlt/agt
lt/tdgt
lt/trgt
lttr style='font-weight:bold;' bgcolor='#00CCFF'gt
lttdgt#lt/tdgt
lttdgtColor Codelt/tdgt
lttdgtCreatedlt/tdgt
lttdgtPublishlt/tdgt
lttd align='center'gtActionlt/tdgt
lt/trgt
";

$flag=false;
foreach($dataPacket as $thisPacket)
{
$url = "{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-form&ID={$thisPacket['ColorID']}";

if($thisPacket['IsActive']==1) $publish="Enable";
if($thisPacket['IsActive']==0) $publish="Disable";

if($flag)
{
$flag=false;
$color="#F7F7F7";
}
else
{
$flag=true;
$color="#EEEEEE";
}

print "
lttr valign='top' bgcolor='{$color}'gt
lttdgt". $thisPacket['ColorID'] ."lt/tdgt
lttdgt". ucwords($thisPacket['ColorCode']) ."lt/tdgt
lttdgt". $thisPacket['DateInserted'] ."lt/tdgt
lttdgt". $publish ."lt/tdgt
lttd align='center' class='main_menu'gt
lta href=\"javascript:popUp('{$url}');\" gtEDITlt/agt
lt/tdgt
lt/trgt
";

}
print "
lttrgt
lttd colspan='4' align='left' class='main_menu'gt
";
/* Start Paging */
$PageNo = 1;
$PageIncrement = 0;
$RowIncrement = $_REQUEST["limitValue"];
$ShowPage = ceil($records/$_REQUEST["limitValue"]);

$ShowstartValue = $_REQUEST["startValue"]+1;

print "Showing results {$ShowstartValue} - ";


if ($_REQUEST["limitValue"] gt $records)
print "{$records} of {$records}";
else
{
$viewValue = $_REQUEST["startValue"] + $_REQUEST["limitValue"];
if ($viewValue gt $records)
print "{$records} of {$records}";
else
print "{$viewValue} of {$records}";
}


print " ";

if($ShowstartValue gt 1)
{
//if(intval($_REQUEST["startValue"] + $RowIncrement) == $records)
//{
// $PreviousLink = $_REQUEST["startValue"];
//}
//else
//{
$PreviousLink = $_REQUEST["startValue"] - $RowIncrement;
//}
print "lta href=\"{$_SERVER['PHP_SELF']}?skin=admin&area={$_REQUEST['area']}&action=site-cat-select&startValue=$PreviousLink&limitValue=$RowIncrement\"gtPreviouslt/agt  ";
}

$NextLink=$_REQUEST["startValue"] + $RowIncrement;
if(intval($records - $NextLink) lt $_REQUEST["limitValue"])
{
$RowIncrement = intval($records - $NextLink);
}
if($NextLink lt $records)
{

print "lta href=\"{$_SERVER['PHP_SELF']}?skin=admin&area={$_REQUEST['area']}&action=site-cat-select&startValue=$NextLink&limitValue=$RowIncrement\"gtNextlt/agt  ";
$RowIncrement = $_REQUEST["limitValue"];
}
/* End Paging */
print "
lt/tdgt
lttd class='main_menu'gt
lta href='{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-form'gtADD NEWlt/agt
lt/tdgt
lt/trgt
lt/tablegt
";
}
else
{
print "
ltdiv style='padding-right:10px; text-align:right;'gt
Total of ltstronggt0lt/stronggt record found.
lta href='{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-form'gtADD NEWlt/agt
lt/divgt
";
}
}
?gt




action.php





lt?php
//Build the server side error check
$error = false;
$errorMessage = "";

// existance check
$table = "colors";
$column = "ColorCode";
$value = trim($_REQUEST['colorCode']);
//$column2 = "CategoryID";
//$value2 = trim($_REQUEST['categoryName']);
if(empty($_REQUEST['ID']) && !empty($_REQUEST['colorCode']))
{
$colorQuery = " SELECT * FROM $table WHERE $column='$value' OR $column='LOWER($value)'";
$colorResult=mysql_query($colorQuery);

if($colorResult != false)
{
$colorRecords = mysql_num_rows($colorResult);
if($colorRecords gt 0)
{
$error = true;
$colorCodeError = true;
$errorMessage.=" ltligtColor Code already exist.lt/ligt";
$thiscolorResult = mysql_fetch_array($colorResult);
if($thiscolorResult['IsActive'] == 0)
{
$errorMessage.=" ltligtPlease enable previous one.lt/ligt";
}
}
}
}
if($_REQUEST['colorCode'] == "")
{
$error = true;
$colorCodeError = true;
$errorMessage.=" ltligtColor Code cannot be empty.lt/ligt";
}


// back to insert user if error occurs
if($error)
{
include "color-form.php";
}
else
{
if(!empty($_REQUEST['ID']))
{
echo $query = "
UPDATE colors
SET
ColorCode = '" . trim($_REQUEST['colorCode']) . "',
IsActive = '" . trim($_REQUEST['publish']) . "',
UserIDUpdated = '" . trim($_SESSION["UserID"]) . "',
DateUpdated = '" . trim(date('Y-m-d H:m:s')) . "'
WHERE ColorID = '{$_REQUEST['ID']}'
";
}
else
{
echo $query = "
INSERT INTO colors
(
ColorCode,
IsActive,
UserIDInserted,
DateInserted
)
VALUES
(
'" . trim($_REQUEST['colorCode']) . "',
'" . trim($_REQUEST['publish']) . "',
'" . trim($_SESSION["UserID"]) . "',
'" . trim(date('Y-m-d H:m:s')) . "'
)
";
}
//exit;
//OperationQuery($query);

$url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-select";
if(!empty($_REQUEST['ID']))
{
$url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}?skin=admin&area={$_REQUEST['area']}&action=color-form&ID={$_REQUEST['ID']}&message=Successfully updated";
}

print "
ltscript language='JavaScript'gt
lt!--
//window.location='$url';
//--gt
lt/scriptgt
";
}

?gt

insert ,update & delete script in php

Table creation:

CREATE TABLE `test_mysql` (
`id` int(4) NOT NULL auto_increment,
`name` varchar(65) NOT NULL default '',
`lastname` varchar(65) NOT NULL default '',
`email` varchar(65) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;

Then creating our database connection called connect.php
<?php
mysql_connect("localhost", "$root", "")or die("cannot connect");
mysql_select_db("test")or die("cannot select DB");
?>



<span style="font-weight:bold;">step 1: insert data in mysql (insert.php)</span>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="300" border="1" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="../rakhi_practice/insert_action.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3" align="center"><strong>Registration</strong></td>
</tr>
<tr>
<td width="71">Name</td>
<td width="6">:</td>
<td width="301"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>Lastname</td>
<td>:</td>
<td><input name="lastname" type="text" id="lastname"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>



<span style="font-weight:bold;">Step 2: insert_action.php</span>
<?php
include("connect.php");

// get values from from
$name=$_POST['name'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
// Insert data into mysql
$sql="INSERT INTO test_mysql(name,lastname,email)VALUES ( '$name','$lastname', '$email')";
$result=mysql_query($sql);
if($result)
{
echo "Congratulations!Please login ";
echo "<BR>";

echo "<a href='list_records.php'>Click here to edit</a>";
}


/*
{
echo "sorry ! U are not succesful";
}*/
mysql_close();
?>



step 3:list_records.php


<?php
include("connect.php");
//select query
$result = mysql_query("SELECT * FROM test_mysql");

?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td colspan="4"><strong>List data from mysql </strong> </td>
</tr>

<tr>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Lastname</strong></td>
<td align="center"><strong>Email</strong></td>
<td align="center"><strong>Update</strong></td>
<td align="center"><strong>Delete</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['lastname']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td align="center"><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td>
<td align="center"><a href="delete.php?id=<?php echo $rows['id']; ?>">delete</a></td>

</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
mysql_close();
?>
<span style="font-weight:bold;">step 4:update.php</span>



<?php
include("connect.php");

// get value of id that sent from address bar
$id=$_REQUEST['id'];



// Retrieve data from database
$result = mysql_query("SELECT * FROM test_mysql WHERE id='$id'");

$rows=mysql_fetch_array($result);

?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="post" action="../rakhi_practice/update_action.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td> </td>
<td colspan="3"><strong>Update data in mysql</strong> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Lastname</strong></td>
<td align="center"><strong>Email</strong></td>
</tr>
<tr>
<td> </td>
<td align="center"><input name="name" type="text" value="<?php echo $rows['name']; ?>"></td>
<td align="center"><input name="lastname" type="text" value="<?php echo $rows['lastname']; ?>" size="15"></td>
<td><input name="email" type="text" value="<?php echo $rows['email']; ?>" size="15"></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" id="id" value="<?php echo $rows['id']; ?>"></td>
<td align="center"><input type="submit" name="Submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<?php

// close connection
mysql_close();

?>



step 5: Update_action.php</span>




<?php
include("connect.php");


$name =$_REQUEST['name'];
$lastname =$_REQUEST['lastname'];
$email =$_REQUEST['email'];
$id =$_REQUEST['id'];



// update data in mysql database
$sql="UPDATE test_mysql SET name='$name', lastname='$lastname', email='$email' WHERE id=".$id;
$result=mysql_query($sql);

// if successfully updated.
if($result)
{
echo "Thanks for update";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}
else
{
echo "ERROR";
}

?>





step 6: Delete.php
<?php
include("connect.php");

// get value of id that sent from address bar
echo $id=$_REQUEST['id'];

$name =$_REQUEST['name'];
$lastname =$_REQUEST['lastname'];
$email =$_REQUEST['email'];
$id =$_REQUEST['id'];


// Retrieve data from database
$result = mysql_query("SELECT * FROM test_mysql WHERE id='$id'");

$rows=mysql_fetch_array($result);

?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="post" action="delete_action.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td> </td>
<td colspan="3"><strong>Delete data </strong> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Lastname</strong></td>
<td align="center"><strong>Email</strong></td>
</tr>
<tr>
<td> </td>
<td align="center"><input name="name" type="text" value="<?php echo $rows['name']; ?>"></td>
<td align="center"><input name="lastname" type="text" value="<?php echo $rows['lastname']; ?>" size="15"></td>
<td><input name="email" type="text" value="<?php echo $rows['email']; ?>" size="15"></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" id="id" value="<?php echo $rows['id']; ?>"></td>
<td align="center"><input type="submit" name="delete" value="delete"></td>
<td> </td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<?php

// close connection
mysql_close();

?>

step 7: delete_action.php
<?php
include("connect.php");


$id =$_REQUEST['id'];
$sql="DELETE from test_mysql WHERE id=".$id;
$result = mysql_query($sql);
if($sql)
{
echo "The record is deleted";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}
else
{
echo "ERROR";
}




?>

Strong Password using Javascript and PHP











Password strength metter























Password not entered










Php scripts in Strong password








User Registration

UserName:

Password:






$username=$_REQUEST['username'];
$password=$_REQUEST['userPassword'];
//$retype=$_REQUEST['retypePassword'];

if($_REQUEST['submit']=="login")
{
if($password)
{
if(preg_match("/^.*(?=.{8,})(?=.*[a-z]+)(?=.*[^A-Za-z0-9])(?=.*[0-9\.\-\@\#\$\&]).*$/",$password))

{
echo "Successfuly checked your password";

}
else
{
echo "Please Enter"."
"."Atleast 8 character"."
"."Alpha numeric value"."
"."1 Special character";
}
}

else
{
echo "
Password field can not be empty
";
}
}

?>




powered by Blogger | WordPress by Newwpthemes | Converted by BloggerTheme