Tuesday, 11 February 2014

Working with Jquery datatable with dynamic data using PHP and Mysql

DataTables is a powerful jQuery plugin for creating table listings and adding interactions to them. It provides searching, sorting and pagination without any configuration. In this article we’ll go through the basics of DataTable and how to use some of the advanced features.

STEP 1 :- Create Database and Table.

We take Example : we create table user in which username and email_id is shown.




STEP 2 :- Now Create Connection in your PHP Page and Connect database with this table .

HERE is the Complete Code of PHP Page : 


<?php
$con = mysqli_connect('localhost','root','','test');
$sqlselect = mysqli_query($con,"SELECT * FROM User");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">

<title>DataTables example - Zero configuration</title>
<link rel="stylesheet" type="text/css" href="media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="resources/demo.css">
<style type="text/css" class="init">

</style>
<script type="text/javascript" language="javascript" src="media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">


$(document).ready(function() {
$('#example').dataTable();
} );


</script>
</head>

<body class="dt-example">
<div class="container">
<section>
<h1>DataTables example <span>- Dynamic with PHP and MYSQL</span></h1>

<div class="info">
<p>DataTables has most features enabled by default, so all you need to do to use it with your own
tables is to call the construction function.</p>

<p>Searching, ordering, paging etc goodness will be immediately added to the table, as shown in this
example.</p>
</div>

<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>USERNAME</th>
<th>EMAIL-ID</th>
</tr>
</thead>

<tfoot>
<tr>
<th>ID</th>
<th>USERNAME</th>
<th>EMAIL-ID</th>
</tr>
</tfoot>

<tbody>
<?php
while($rowselect = mysqli_fetch_array($sqlselect))
{
echo"<tr>
<td>".$rowselect['ID']."</td>
<td>".$rowselect['usernam']."</td>
<td>".$rowselect['email']."</td>
</tr>";
}
?>
</tbody>
</table>
</div>
</body>
</html>
You Can Download It From Here : Click Here

For Any Query Please Write a comment !!

Thanks












Sunday, 1 December 2013

Send e-mail in PHP

For Sending Mail in PHP their is inbuilt funtion to send e-mails in php but this function only works in server where you can send your e-mail with your server e-mails.

mail(to,subject,message,headers,parameters)

Here is running example of mail function in php

<?php
if(isset($_POST['btn_email']))
{
$email_to = "sender-email";
        $email_subject = "Subject";
$name=$_POST['name'];
$email=$_POST['email'];
$sub=$_POST['Subject'];
$messagenew=$_POST['message'];
$email_message = "Name: ".$name."\n";
    $email_message .= "Email: ".$email."\n";
    $email_message .= "Subject: ".$sub."\n";
    $email_message .= "Message: ".$messagenew."\n";
// create email headers
$headers = 'From: '.$email."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
 
echo"<script>alert('Thank you for contacting us. We will be in touch with you very soon.');</script>";
}
?>
<form action="Contact.php" method="post" class="std" enctype="multipart/form-data">
<h1 style='color:black'>Send a message</h1>
<p class="text select">
<label for="id_order">Name</label>
<input type="text" name="name" id="name" value="" />
</p>
<p class="text select">
<label for="id_order">Subject</label>
<input type="text" name="Subject" id="Subject" value="" />
</p>
<p class="text">
   <label for="email">E-mail address</label>
<input type="text" id="email" name="email" value="" />
</p>
<p class="textarea">
<label for="message">Message</label>
<textarea id="message" name="message" ></textarea>
</p>
<p class="submit">
<input type="submit" name="btn_email" id="btn_email" value="Send" class="button_large" onclick="$(this).hide();" />
</p>
</form>
You Can Download It From Here : Click Here

For Any Query Please Write a comment !!

Thanks

Saturday, 30 November 2013

Web Based 3D Dock Menus



Here is The Complete Source Code of The 3D Dock Menu: 
<!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=iso-8859-1" />
<title>CSS 3D Dock Menu</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/interface.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="dock" id="dock">
  <div class="dock-container">
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/home.png" alt="home" /><span>Blog Home</span></a> 
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/email.png" alt="contact" /><span>Designer Wall</span></a> 
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/portfolio.png" alt="portfolio" /><span>Design Jobs</span></a> 
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/music.png" alt="music" /><span>Best Web Gallery</span></a> 
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/video.png" alt="video" /><span>IconDock</span></a> 
  <a class="dock-item" href="http://newwebonline.blogspot.in/"><img src="images/history.png" alt="history" /><span>Stock Icons</span></a>
  </div> 
</div>
<!--bottom dock -->
<div class="dock" id="dock2">
  <div class="dock-container2">
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Home</span><img src="images/home.png" alt="home" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Contact</span><img src="images/email.png" alt="contact" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Portfolio</span><img src="images/portfolio.png" alt="portfolio" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Music</span><img src="images/music.png" alt="music" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Video</span><img src="images/video.png" alt="video" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>History</span><img src="images/history.png" alt="history" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Calendar</span><img src="images/calendar.png" alt="calendar" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>Links</span><img src="images/link.png" alt="links" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>RSS</span><img src="images/rss.png" alt="rss" /></a> 
  <a class="dock-item2" href="http://newwebonline.blogspot.in/"><span>RSS2</span><img src="images/rss2.png" alt="rss" /></a> 
  </div>
</div>

<!--dock menu JS options -->
<script type="text/javascript">
$(document).ready(
function()
{
$('#dock').Fisheye(
{
maxWidth: 50,
items: 'a',
itemsText: 'span',
container: '.dock-container',
itemWidth: 40,
proximity: 90,
halign : 'center'
}
)
$('#dock2').Fisheye(
{
maxWidth: 60,
items: 'a',
itemsText: 'span',
container: '.dock-container2',
itemWidth: 40,
proximity: 80,
alignment : 'left',
valign: 'bottom',
halign : 'center'
}
)
}
);

</script>
</body>
</html>
Output Like This :




Download Click Here