This is the first url: http://localhost/SquprimeRevise/administrator/admin/invoice_edit.php?group_id=7&type=new
invoice_edit.php
<!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>Squprime</title>
<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->
<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
</head>
<body>
<div id="wrapper">
<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
<h1><a href="#"><span>Squprime</span></a></h1>
<img src="images/logo2.png" height="70px" style="margin: -45px 0 0 -180px; position: absolute;"><br><!--<img src="images/admin.png" height="60px" style="margin: -20px 0 0 430px">--><br><br>
<!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
<?php include('top_nav.php'); ?>
<!-- // #end mainNav -->
<div id="containerHolder">
<div id="container">
<div id="sidebar">
<?php include("admin_nav.php"); ?>
<!-- // .sideNav -->
</div>
<!-- // #sidebar -->
<div style="margin: -15px 0 0 230px; width: 700px; position: absolute;">
<!-- h2 stays for breadcrumbs -->
<h2><a href="#">Dashboard</a> » <a href="#" class="active">Invoice</a></h2>
</div>
<!-- Insert New -->
<div id="menu">
<center>
</center>
<p> </p>
<p> </p><center>
<p>
<?php
include('includes/koneksi.php');
$group_id = isset($_GET['group_id']) ? $_GET['group_id'] : '';
$date = isset($_POST['date']) ? $_POST['date'] : '';
$confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';
$group_date = isset($_POST['group_date']) ? $_POST['group_date'] : '';
$group_name = isset($_POST['group_name']) ? $_POST['group_name'] : '';
$group_package = isset($_POST['group_package']) ? $_POST['group_package'] : '';
$group_level = isset($_POST['group_level']) ? $_POST['group_level'] : '';
$group_teacher = isset($_POST['group_teacher']) ? $_POST['group_teacher'] : '';
$group_payment = isset($_POST['group_payment']) ? $_POST['group_payment'] : '';
//Simpan berita
if (isset($_POST['ok'])){
echo "test";
if (empty($_GET['group_id']))
{
$sqlstr = "INSERT INTO `invoice`(group_id, group_date, group_package, group_level, group_teacher, group_payment) VALUES('".$group_id."','".$group_date."','".$group_package."','".$group_level."','".$group_teacher."','".$group_payment."')";
}
else
{
$sqlstr = "UPDATE `invoice` SET group_date='".$group_date."', group_id='".$_GET['group_id']."', group_package='".$group_package."', group_level='".$group_level."', group_teacher='".$group_teacher."' WHERE group_id='".$_GET['group_id']."'";
}
$result = mysql_query($sqlstr) or die(mysql_error());
//Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
//if (empty($_REQUEST['id'])) kirimEmail($idKategori, $judul, $news);
$confirmation = ($result) ? "Data has been saved." : "Fail to save data.";
}
echo "test2";
//Load berita
if (!empty($_GET['group_id']) && (empty($_GET['type']) or $_GET['type']!='new') ){
$result = mysql_query("SELECT * FROM `invoice`
INNER JOIN `group`
ON invoice.group_id = `group`.group_id
WHERE invoice.group_id =".$_GET['group_id']) or die(mysql_error());
$data = mysql_fetch_array($result);
$group_id = $data['group_id'];
$group_date = $data['group_date'];
$group_name = $data['group_name'];
$group_package = $data['group_package'];
$group_level = $data['group_level'];
$group_teacher = $data['group_teacher'];
$group_payment = $data['group_payment'];
}else {
$result = mysql_query("SELECT * FROM `group` WHERE group_id =".$_GET['group_id']) or die(mysql_error());
$data = mysql_fetch_array($result);
// set all empty for new info except for group name
$group_id = "";
$group_date = "";
$group_name = $data['group_name'];
$group_package = "";
$group_level = "";
$group_teacher = "";
$group_payment = "";
}
?>
<div align="center">
<div style="width:800px;text-align:left;">
<?php echo '<br><br>'; ?>
<?php echo $confirmation;?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']."?group_id=".$group_id; ?>">
<!-- <input type="hidden" name="id" value="<?php// echo $id; ?>"/>--><br><br><br><br><br><br>
<table>
<tr>
<td>Group Date</td>
<td><input id="datedate" type="text" size="15px" name="group_date" value="<?php echo $group_date; ?>"></td>
</tr>
<tr>
<td>Group Name <font color="red"></font></td>
<td><input type="text" size="30px" name="group_name" value="<?php echo $group_name; ?>" disabled></td>
</tr>
<tr>
<td valign="top">Package</td>
<td><?php
$row = mysql_query("SELECT * FROM `package`") or die(mysql_error());
echo '<select name="group_package">';
while($data = mysql_fetch_array($row)){
echo '<option value="'.$data['package'].'"';
if($group_package == $data['package']){
echo 'selected="selected"';}
echo '>'.$data['package'].'</option>';
}
echo '</select>';
?></td>
</tr>
<tr>
<td>Level</td>
<td><?php
$row2 = mysql_query("SELECT * FROM `level`") or die(mysql_error());
echo '<select name="group_level">';
while($data2 = mysql_fetch_array($row2)){
echo '<option value="'.$data2['level
_name'].'"';
if($group_level == $data2['level_name']){
echo 'selected="selected"';}
echo '>'.$data2['level_name'].'</option>';
}
echo '</select>';
?></td>
</tr>
<tr>
<td>Teacher</td>
<td><input type="text" size="30px" name="group_teacher" value="<?php echo $group_teacher; ?>">
</td>
</tr>
<tr>
<td>Payment</td>
<td><?php
$row2 = mysql_query("SELECT * FROM `group`") or die(mysql_error());
echo '<select name="group_payment">';
echo '<option value="PAID"';
if($group_payment == "PAID"){
echo 'selected="selected"';}
echo '>PAID</option>';
echo '<option value="UNPAID"';
if($group_payment == "UNPAID"){
echo 'selected="selected"';}
echo '>UNPAID</option>';
echo '</select>';
?></td>
</tr>
<tr>
<td></td>
<td><br><input type="submit" name="ok" value="Save" class="abutton"/></td>
</tr>
</table>
</form>
</div>
</div>
</div>
<script src="jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.mask.definitions['~'] = "[+-]";
$("#datedate").mask("9999-99-99",{completed:function(){alert("completed!");}});
$("input").blur(function() {
$("#info").html("Unmasked value: " + $(this).mask());
}).dblclick(function() {
$(this).unmask();
});
});
</script>
<!-- End Insert -->
<div class="clear"></div>
</div>
<!-- // #container -->
</div>
<!-- // #containerHolder -->
<p id="footer">Feel free to use and customize it. <a href="http://www.perspectived.com">Credit is appreciated.</a></p>
</div>
<!-- // #wrapper -->
</body>
</html>
After someone press add invoice to add new invoice, this message appears:
testtest2You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I wonder why the error appears and which SQL syntax might causes the error.