0

Hello,

I am trying to record $remaining package to the database but it doesn't work. I wonder why?

groupinfo_edit.php

<?php

// Check if session is not registered, redirect back to main page.
// Put this code in first line of web page.


session_start();


if(!isset($_SESSION['username']))
    {
    header("location:index.php");
    exit;
    }

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Squprime Admin Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="rustoleum, coating" />
<meta name="description" content="Rustoleum Indonesia provides coating solution for industrial requirement and individual needs." />

<style type="text/css">
#slideshow { left: 35px; float: left; margin: 10px; z-index: 0;}
#nav { width: 270px; margin: 170px 0 0 225px; float: left; position: absolute; z-index: 1;}
#nav li { float: left; margin: 0 0 0 4px; list-style: none; background: url(images/pager3-2.jpg) no-repeat top;}
#nav a { width: 40px; padding: 3px; display: block; border: 1px solid #ccc;}
#nav li.activeSlide a { /* background: #88f */ background: url(images/pager3.jpg) no-repeat top;}
#nav a:focus { outline: none;}
#nav img { border: none; display: block;}
pre { clear: left }
</style>
<script src="../../js/jquery.min.js" type="text/javascript"></script>
<script src="../../js/chili-1.7.pack.js"></script>
<script src="../../js/jquery.cycle.all.js" type="text/javascript"></script>
<script src="../../js/jquery.easing.1.3.js" type="text/javascript" ></script>
<link href= "../../css/admin.css" rel="stylesheet" type="text/css" media="screen">
<link href= "../../css/navstyleadmin.css" rel="stylesheet" type="text/css" media="screen">
<script type="text/javascript">
$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   900, 
    timeout: 10000, 
    pager:  '#nav', 
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#nav li:eq(' + idx + ') a'; 
    } 
});
</script>

<script src="ckeditor/ckeditor.js"></script>
</head>

<div id="main-wrap1">
<body>

<?php include('../header2.php'); ?>

<?php   include("../adminnavcssjs.php");  ?>
<?php   include("../adminnav2.php");  ?>

<!-- <hr style="height:400px;width:1px;border-color:#eeeeee;margin: -50px 0 0 220px;" /> --> 

<img src="../images/line.png" style="repeat-x; width: 10px; height:800px; margin: -60px 0 0 10px;">


<div id="menu" style="margin-top: -700px;">
      <center>
        <div id="title"><h2>Edit Group Info</h2></div>
      </center>
      <p>&nbsp;</p>

  <p>&nbsp;</p><center>
      <p>

<?php

    include('../../includes/koneksi.php');

    $group_id = isset($_POST['group_id']) ? $_POST['group_id'] : '';  
    $confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';  
    $group_name = isset($_POST['group_name']) ? $_POST['group_name'] : ''; 
    $group_info = isset($_POST['group_info']) ? $_POST['group_info'] : '';
    $group_level = isset($_POST['group_level']) ? $_POST['group_level'] : '';
    $group_package = isset($_POST['group_package']) ? $_POST['group_package'] : '';
    $group_teacher = isset($_POST['group_teacher']) ? $_POST['group_teacher'] : '';
    $group_payment = isset($_POST['group_payment']) ? $_POST['group_payment'] : ''; 
    $remaining_package = isset($_POST['remaining_package']) ? $_POST['remaining_package'] : ''; 

    //echo "Test";
    //echo $group_level;
    //echo $group_package;
    //echo $group_payment;
    //print_r($_POST);
    echo "Test";
    echo $remaining_package;

    //Simpan berita 
    if (isset($_POST['ok'])){       

        if (empty($_GET['group_id']))
            {
            $sqlstr = "INSERT INTO `group`(group_name, group_info, group_level, group_remaining_package, group_package, group_teacher, group_payment) VALUES('".$group_name."','".$group_info."','".$group_level."','".$remaining_package."','".$group_package."', '".$group_teacher."', '".$group_payment."')";            
            }
        else
            {           
            $sqlstr = "UPDATE `group` SET group_name='".$group_name."', group_info='".$group_info."', group_package='".$group_package."', group_level='".$group_level."', group_remaining_package='".$remaining_package."', group_teacher='".$group_teacher."', group_payment='".$group_payment."' 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.";  
    }

    //Load berita
    if (!empty($_GET['group_id'])){

        $result = mysql_query("SELECT * FROM `group` WHERE group_id =".$_GET['group_id']) or die(mysql_error());
        $data = mysql_fetch_array($result);     
        $group_id = $data['group_id'];
        $group_name = $data['group_name'];
        $group_info = $data['group_info'];
        $group_package = $data['group_package'];
        $group_level = $data['group_level'];
        $group_teacher = $data['group_teacher'];
        $group_payment = $data['group_payment'];
        $remaining_package = $data['group_remaining_package'];

    }else {
        // set all empty for new info
        $group_id = "";
        $group_name = "";
        $group_info = "";
        $group_package = "";
        $group_level = "";
        $group_teacher = "";
        $group_payment = "";
        $remaining_package = "";
    }

    ?>

    <div align="center">
        <div style="width:800px;text-align:left;">
        <?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; ?>"/>-->
            <table>
                <tr>
                    <td>Group Name <font color="red">*</font></td>              
                    <td><input type="text" size="50px" name="group_name" value="<?php echo $group_name; ?>"></td>
                </tr>
                <tr>
                    <td valign="top">Information</td>             
                    <td>
                        <textarea cols="50" rows="5" id="news" name="group_info"><?php echo $group_info;?></textarea>
                        <script type="text/javascript">
                            var editor = CKEDITOR.replace('news');
                        </script>                    </td>
                </tr>
                <tr>
                    <td>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>Remaining Package</td>
                    <td><input type="text" size="10px" name="remaining-package" value="<?php echo $remaining_package; ?>">
                    </td>
                </tr>
                <tr>
                    <td>Level</td>
                    <td>
                    <?php //$group_level = 'intermediate 1'; ?>
                    <?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>
                    <?php
                    $row3 = mysql_query("SELECT * FROM `teacher`") or die(mysql_error());
                    echo '<select name="group_teacher">';
                    while($data = mysql_fetch_array($row3)){
                        echo '<option value="'.$data['teach_fname'].'&nbsp;'.$data['teach_lname'].'"';
                        $teach_fullname = $data['teach_fname'].'&nbsp'.$data['teach_lname'];
                        if($group_teacher == $teach_fullname){
                        echo 'selected="selected"';}
                        echo '>'.$data['teach_fname'].'&nbsp;'.$data['teach_lname'].'</ophtion>';

                        }                   

                    echo '</select>';
                    ?>
                    </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>    


<br><br><br><br><br><br><br><br><br><br><br><br>     
<p>&nbsp;</p>

<?php include('../adminfooter.php'); ?>
</body>
</html>
2
Contributors
1
Reply
13
Views
3 Years
Discussion Span
Last Post by noelthefish
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.