Commit 0c6a4554 by Andry F. Hutapea

perubahan

parent 66a29b3d
<?php
session_start();
include_once('config/koneksi.php');
open_page('booking');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/iconFont.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<title>Booking Paket</title>
</head>
<body class="metro">
<header class="bg-darkCobalt" data-load="atasan.php"></header>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="tbc"; // Database name
$tbl_name="fanswer"; // Table name
// Connect to server and select databse.
$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
// Get value of id that sent from hidden field
$id=$_GET['id'];
// Find highest answer number.
$sql="SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE question_id='$id'";
$result=mysqli_query($conn,$sql);
$rows=mysqli_fetch_array($result);
// add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1
if ($rows) {
$Max_id = $rows['Maxa_id']+1;
}
else {
$Max_id = 1;
}
// get values that sent from form
$a_name=$_POST['a_name'];
$a_email=$_POST['a_email'];
$a_answer=$_POST['a_answer'];
$datetime=date("d/m/y H:i:s"); // create date and time
// Insert answer
$sql2="INSERT INTO fanswer(question_id, a_id, a_name, a_email, a_answer, a_datetime)VALUES('$id', '$Max_id', '$a_name', '$a_email', '$a_answer', '$datetime')";
$result2=mysqli_query($conn,$sql2);
if($result2){
echo "Successful<BR>";
echo "<a href='view_topic.php?id=".$id."'>View your answer</a>";
// If added new answer, add value +1 in reply column
$tbl_name2="fquestions";
$sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
$result3=mysqli_query($conn,$sql3);
}
else {
echo $result2;
echo $id."<br>";
echo $a_name."<br>";
echo $a_email."<br>";
echo $a_answer."<br>";
echo $Max_id."<br>";
echo "ERROR";
}
// Close connection
//mysql_close();
?>
</BR></td></tr></table></center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div></div>
<footer class="dark" data-load="bawahan.php"></footer>
</body>
</html>
<?php
session_start();
include_once('config/koneksi.php');
open_page('booking');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/iconFont.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<title>Booking Paket</title>
</head>
<body class="metro">
<header class="bg-darkCobalt" data-load="atasan.php"></header>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="tbc"; // Database name
$tbl_name="fquestions"; // Table name
// Connect to server and select database.
$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
// get data that sent from form
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];
$datetime=date("d/m/y h:i:s"); //create date time
$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
$result=mysqli_query($conn,$sql);
if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
//mysql_close();
?>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="new_topic.php"><strong>Create New Topic</strong> </a></td>
</tr>
</table></BR></td></tr></table></center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<footer class="dark" data-load="bawahan.php"></footer>
</body>
</html>
<?php
session_start();
include_once('config/koneksi.php');
open_page('booking');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/iconFont.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href="css/animate1.css" rel="stylesheet" type="text/css">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<title>Booking Paket</title>
</head>
<ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s">
<body class="metro">
<header class="bg-darkCobalt" data-load="atasan.php"></header>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="tbc"; // Database name
$tbl_name="fquestions"; // Table name
// Connect to server and select databse.
$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending
$result=mysqli_query($conn,$sql);
$no=0;
?>
<br><br>
<center>
<table width="50%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="10%" align="center" bgcolor="#E6E6E6"><strong>No</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic komentar</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Dilihat</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Balasan</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>
<?php
// Start looping table row
while($rows = mysqli_fetch_array($result)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><?php echo ++$no;; ?></td>
<td align="center" bgcolor="#FFFFFF"><a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['datetime']; ?></td>
</tr>
<?php
// Exit looping and close connection
}
//mysql_close();
?>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="new_topic.php"><strong>Tambah Komentar</strong> </a></td>
</tr>
</table></BR></td></tr></table></center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<footer class="dark" data-load="bawahan.php"></footer>
</body>
</html>
<?php
session_start();
include_once('config/koneksi.php');
open_page('booking');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/iconFont.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href="css/animate1.css" rel="stylesheet" type="text/css">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<title>Booking Paket</title>
</head>
<ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s">
<body class="metro">
<header class="bg-darkCobalt" data-load="atasan.php"></header>
<br><br><br>
<html>
<head>
</head>
<body>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="add_new_topic.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#E6E6E6"><strong>Create New Topic</strong> </td>
</tr>
<tr>
<td width="14%"><strong>Topic</strong></td>
<td width="2%">:</td>
<td width="84%"><input name="topic" type="text" id="topic" size="50" /></td>
</tr>
<tr>
<td valign="top"><strong>Detail</strong></td>
<td valign="top">:</td>
<td><textarea name="detail" cols="50" rows="3" id="detail"></textarea></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50" /></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="email" type="text" id="email" size="50" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<footer class="dark" data-load="bawahan.html"></footer>
</body>
</html>
<?php
session_start();
include_once('config/koneksi.php');
open_page('booking');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/iconFont.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href="css/animate1.css" rel="stylesheet" type="text/css">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<title>Booking Paket</title>
</head>
<ul class="tp-hd-lft wow fadeInDown animated" data-wow-delay="0.5s">
<body class="metro">
<header class="bg-darkCobalt" data-load="atasan.php"></header></body>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="tbc"; // Database name
$tbl_name="fquestions"; // Table name
// Connect to server and select databse.
$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
// get value of id that sent from address bar
$id=$_GET['id'];
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysqli_query($conn,$sql);
$rows=mysqli_fetch_array($result);
?>
<a href="main_forum.php">home</a>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#ffffff">
</tr>
<tr>
<td bgcolor="#ffffff" style="width:80px"><strong>Nama :</strong> <?php echo $rows['name']; ?> <br></td>
<td bgcolor="#ffffff" colspan="2" style="text-align: right"><?php echo $rows['datetime']; ?></td>
</tr>
<tr>
<td>
<strong>Email : </strong><?php echo $rows['email'];?></td>
</tr>
<tr>
<td colspan="4" bgcolor="#ffffff"><strong>Topic : <?php echo $rows['topic']; ?></strong></td>
</tr>
<tr>
<td colspan="4" bgcolor="#ffffff"><strong>Komentar : </strong><?php echo $rows['detail']; ?></td>
</tr>
<tr>
</tr>
<tr>
</tr>
</td>
</tr>
</table>
<BR>
<?php
$tbl_name2="fanswer"; // Switch to table "forum_answer"
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysqli_query($conn,$sql2);
while($rows=mysqli_fetch_array($result2)){
?>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#F8F7F1">
<tr>
<td width="77%" bgcolor="#F8F7F1" colspan="3"><strong>Name : </strong><?php echo $rows['a_name']; ?><br><strong>Email : </strong><?php echo $rows['a_email']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1" colspan="3"></td>
</tr>
<tr>
<td bgcolor="#F8F7F1" colspan="3"><strong>Komentar :<br></strong><?php echo $rows['a_answer']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1" colspan="3" style="text-align: right"><?php echo $rows['a_datetime']; ?></td>
</tr>
</td>
</tr>
</table><br>
<?php
}
$sql3="SELECT view FROM $tbl_name WHERE id='$id'";
$result3=mysqli_query($conn,$sql3);
$rows=mysqli_fetch_array($result3);
$view=$rows['view'];
// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";
$result4=mysqli_query($conn,$sql4);
}
// count more value
$addview=$view+1;
$sql5="update $tbl_name set view='$addview' WHERE id='$id'";
$result5=mysqli_query($conn,$sql5);
?>
<center><h3>Tambahkan Komentar Anda</h3></center>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="add_answer.php?<?php echo 'id='.$id; ?>">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="2" width="18%"><strong>Name</strong></td>
</tr>
<tr>
<td colspan="2" width="79%"><input name="a_name" type="text" id="a_name" size="45"></td>
</tr>
</tr>
<tr>
<td colspan="2"><strong>Email</strong></td>
</tr>
<tr>
<td colspan="2"><input name="a_email" type="text" id="a_email" size="45"></td>
</tr>
</tr>
<tr>
<td colspan="2" valign="top"><strong>Answer</strong></td>
</tr>
<tr>
<td colspan="2"><textarea name="a_answer" cols="47" rows="3" id="a_answer"></textarea></td>
</tr>
</tr>
<tr>
<td><input name="id" type="hidden" value="<?php echo $id; ?>"></td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<body>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment