<?
session_start();
date_default_timezone_set('Asia/Calcutta');
include("config.php");
$newsid=$_GET['id'];
if(isset($_GET['submit']))
{
$today = date("F j, Y, g:i a");
$name=$_GET['name'];
$comment=$_GET['comment'];
$newsid=$_GET['newsid'];
mysql_query("insert into messages (comment,newsid,name,today) values('$comment','$newsid','$name','$today') ");
header("location:readmorenews.php?id=$newsid");
}
?>
<!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>Insert Record with jQuery and Ajax</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".comment_button").click(function(){
var element = $(this);
var I = element.attr("id");
$("#slidepanel"+I).slideToggle(300);
$(this).toggleClass("active");
return false;});});
</script>
<style type="text/css">
body
{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
.comment_box
{
background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px
}
h1
{
color:#555555
}
a
{
text-decoration:none;
color:#d02b55;
}
a:hover
{
text-decoration:underline;
color:#6FB4DE;
}
*{margin:0;padding:0;}
ol.timeline
{list-style:none;font-size:1.2em;}ol.timeline li{ position:relative;padding:.7em 0 .6em 0; height:45px; border-bottom:#dedede dashed 1px}ol.timeline li:first-child{border-top:1px dashed #dedede;}
.comment_button
{
margin-right:30px; background-color:#000; color:#fff; border:#333333 solid 1px; padding:3px;font-weight:bold; font-size:11px; font-family:Arial;
}
.comment_submit
{
background-color:#000; color:#FFFFFF; border:none; font-size:11px; padding:3px; margin-top:3px;
}
.panel
{
margin-left:0px; margin-right:0px; margin-bottom:5px; background-color:#D3E7F5; height:75px; padding:6px; width:700px;
display:none;
}
.panel_a
{
margin-left:50px; margin-right:50px; margin-bottom:5px; background-color:#D3E7F5; height:45px; padding:6px; width:400px;
display:none;
}
</style>
</head>
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" width="600px" align="left";>
<tr>
<td>
<ol id="update" class="timeline">
<?php
include("config.php");
$sql = mysql_query("SELECT * FROM messages ");
while($row=mysql_fetch_array($sql))
{
$msg_id=$row['msg_id'];
$comment=$row['comment'];
$name=$row['name'];
?>
<div align="left">
<div style="clear:both"></div>
<a href="#" class="comment_button" id="<?php echo $msg_id; ?>">Comment</a>
<div style="clear:both"></div>
<table style=" font-family:arial; font-size:13px; color:#333; margin:10px 0px 0px 0px; width:710px;">
<?
$sql = mysql_query("SELECT * FROM messages where newsid='$newsid' ");
$number=mysql_num_rows($sql);
while($row=mysql_fetch_array($sql))
{
$user=$row[3];
?>
<tr>
<td style='border-width:0px 0px 1px 0px; border-style:solid; border-color:#333; width:10%; line-height:25px;'><img src="admin/uploads/<?
if($number>0)
{
$query=mysql_query("SELECT * FROM new_emp where name='$user' ");
while($rowk=mysql_fetch_array($query))
{
echo $rowk[7];
}
}
?>" height="55" width="52" alt="<?=$name?>" title="<?=$name?>"/></td>
<td style='border-width:0px 0px 1px 0px; border-style:solid; border-color:#333; width:90%; line-height:25px;'><?=$row[1]?><br/><strong style="color:#2B70B8">(<?=$row[4]?>)</strong></td>
<tr>
<?
}
?>
</table>
</div>
<div class='panel' id="slidepanel<?php echo $msg_id; ?>" style="height:auto;">
<form action="multi.php" method="get">
<table width="100%" cellpadding="4" cellspacing="1">
<tr>
<td><strong>Name:</strong></td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td><strong>Comment Area:</strong></td>
<td><textarea style="width:400px;height:50px" name="comment"></textarea><br />
<input type="hidden" name="newsid" value="<?=$newsid?>" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value=" Comment " name="submit" class="comment_submit" /></td>
</tr>
</table>
</form>
</div>
<?php } ?>
</ol>
</td>
</tr>
</table>
</div>
</body>
</html>
session_start();
date_default_timezone_set('Asia/Calcutta');
include("config.php");
$newsid=$_GET['id'];
if(isset($_GET['submit']))
{
$today = date("F j, Y, g:i a");
$name=$_GET['name'];
$comment=$_GET['comment'];
$newsid=$_GET['newsid'];
mysql_query("insert into messages (comment,newsid,name,today) values('$comment','$newsid','$name','$today') ");
header("location:readmorenews.php?id=$newsid");
}
?>
<!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>Insert Record with jQuery and Ajax</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".comment_button").click(function(){
var element = $(this);
var I = element.attr("id");
$("#slidepanel"+I).slideToggle(300);
$(this).toggleClass("active");
return false;});});
</script>
<style type="text/css">
body
{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
.comment_box
{
background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px
}
h1
{
color:#555555
}
a
{
text-decoration:none;
color:#d02b55;
}
a:hover
{
text-decoration:underline;
color:#6FB4DE;
}
*{margin:0;padding:0;}
ol.timeline
{list-style:none;font-size:1.2em;}ol.timeline li{ position:relative;padding:.7em 0 .6em 0; height:45px; border-bottom:#dedede dashed 1px}ol.timeline li:first-child{border-top:1px dashed #dedede;}
.comment_button
{
margin-right:30px; background-color:#000; color:#fff; border:#333333 solid 1px; padding:3px;font-weight:bold; font-size:11px; font-family:Arial;
}
.comment_submit
{
background-color:#000; color:#FFFFFF; border:none; font-size:11px; padding:3px; margin-top:3px;
}
.panel
{
margin-left:0px; margin-right:0px; margin-bottom:5px; background-color:#D3E7F5; height:75px; padding:6px; width:700px;
display:none;
}
.panel_a
{
margin-left:50px; margin-right:50px; margin-bottom:5px; background-color:#D3E7F5; height:45px; padding:6px; width:400px;
display:none;
}
</style>
</head>
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" width="600px" align="left";>
<tr>
<td>
<ol id="update" class="timeline">
<?php
include("config.php");
$sql = mysql_query("SELECT * FROM messages ");
while($row=mysql_fetch_array($sql))
{
$msg_id=$row['msg_id'];
$comment=$row['comment'];
$name=$row['name'];
?>
<div align="left">
<div style="clear:both"></div>
<a href="#" class="comment_button" id="<?php echo $msg_id; ?>">Comment</a>
<div style="clear:both"></div>
<table style=" font-family:arial; font-size:13px; color:#333; margin:10px 0px 0px 0px; width:710px;">
<?
$sql = mysql_query("SELECT * FROM messages where newsid='$newsid' ");
$number=mysql_num_rows($sql);
while($row=mysql_fetch_array($sql))
{
$user=$row[3];
?>
<tr>
<td style='border-width:0px 0px 1px 0px; border-style:solid; border-color:#333; width:10%; line-height:25px;'><img src="admin/uploads/<?
if($number>0)
{
$query=mysql_query("SELECT * FROM new_emp where name='$user' ");
while($rowk=mysql_fetch_array($query))
{
echo $rowk[7];
}
}
?>" height="55" width="52" alt="<?=$name?>" title="<?=$name?>"/></td>
<td style='border-width:0px 0px 1px 0px; border-style:solid; border-color:#333; width:90%; line-height:25px;'><?=$row[1]?><br/><strong style="color:#2B70B8">(<?=$row[4]?>)</strong></td>
<tr>
<?
}
?>
</table>
</div>
<div class='panel' id="slidepanel<?php echo $msg_id; ?>" style="height:auto;">
<form action="multi.php" method="get">
<table width="100%" cellpadding="4" cellspacing="1">
<tr>
<td><strong>Name:</strong></td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td><strong>Comment Area:</strong></td>
<td><textarea style="width:400px;height:50px" name="comment"></textarea><br />
<input type="hidden" name="newsid" value="<?=$newsid?>" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value=" Comment " name="submit" class="comment_submit" /></td>
</tr>
</table>
</form>
</div>
<?php } ?>
</ol>
</td>
</tr>
</table>
</div>
</body>
</html>
No comments:
Post a Comment
Thank you for your Comment....