Undefined variable student_id, I wonder why? That url appears after I press save.



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




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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 }
<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">
    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 src="ckeditor/ckeditor.js"></script>

<div id="main-wrap1">

<?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;">
      <?php// if (empty($_GET['profile_id'])){?>
        <div id="title"><h2>Add Student Progress Table</h2></div>
      <p> </p>
      <?php//}else{?> <!--
        <div id="title"><h2>Edit Student Profile</h2></div>
      <p> </p>
     <?php// } ?> -->

  <p> </p><center>



    $study_progtab_id = isset($_POST['study_progtab_id']) ? $_POST['study_progtab_id'] : '';  
    $lesson = isset($_POST['lesson']) ? $_POST['lesson'] : ''; 
    $date = isset($_POST['date']) ? $_POST['date'] : '';  
    $exercise = isset($_POST['exercise']) ? $_POST['exercise'] : '';  
    $weakness = isset($_POST['weakness']) ? $_POST['weakness'] : '';
    $progress = isset($_POST['progress']) ? $_POST['progress'] : '';    
    $teacher_advice = isset($_POST['teacher_advice']) ? $_POST['teacher_advice'] : ''; 
    $homework = isset($_POST['homework']) ? $_POST['homework'] : '';
    $listening = isset($_POST['listening']) ? $_POST['listening'] : ''; 
    $grammar = isset($_POST['grammmar']) ? $_POST['grammar'] : '';
    $conversation = isset($_POST['conversation']) ? $_POST['conversation'] : '';
    $reading = isset($_POST['reading']) ? $_POST['reading'] : '';
    $confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';
    $confirmation2 = isset($_POST['confirmation2']) ? $_POST['confirmation2'] : '';

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

        if (empty($_GET['study_progtab_id']))

            //$username = substr($stu_fname, 0, 1).$stu_lname;
            //$username = strtolower($username);

            $sqlstr = "INSERT INTO `study_progtab`(lesson, date, exercise, weakness, progress, teacher_advice, homework, listening, grammar, conversation, reading) VALUES('".$lesson."','".$date."', '".$exercise."', '".$weakness."','".$progress."', '".$teacher_advice."', '".$homework."','".$listening."','".$grammar."','".$conversation."','".$reading."')";

            $sqlstr = "UPDATE `study_progtab` SET study_progtab_id='".$study_progtab_id."', lesson='".$lesson."', date='".$date."', exercise='".$exercise."', weakness='".$weakness."', progress='".$progress."', teacher_advice='".$teacher_advice."', homework='".$homework."', listening='".$listening."', grammar='".$grammar."', conversation='".$conversation."', reading='".$reading."' WHERE study_progtab_id=".$_GET['study_progtab_id'];

        $result = mysql_query($sqlstr) or die(mysql_error());
        //$result2 = mysql_query($sqlstr2) 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.";
        //$confirmation2 = ($result2) ? "Study Report has been saved." : "Fail to save data.";

        //Load Student Profile
    if (!empty($_GET['student_id'])){
        $result = mysql_query("SELECT * FROM student WHERE student_id =".$_GET['student_id']) or die(mysql_error());
        $data = mysql_fetch_array($result);
        $student_id = $data['student_id'];
        $lesson = $data['lesson'];
        $date = $data['date'];
        $exercise = $data['exercise'];
        $weakness = $data['weakness'];
        $progress = $data['progress'];
        $teacher_advice = $data['teacher_advice'];
        $homework = $data['homework'];
        $listening = $data['listening'];
        $grammar = $data['grammar'];
        $conversation = $data['conversation'];
        $reading = $data['reading'];

    else {
    //echo "unable to select data".'<br>';
    //echo "student_id is empty";
    <div align="center">
        <div style="width:800px;text-align:left;">
        <?php echo $confirmation;?>
        <?php //echo $confirmation2;?>
        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?student_id='.$student_id;?>">
            <!-- <input type="hidden" name="id" value="<?php// echo $id; ?>"/>-->


                    $rs = mysql_query("SELECT * FROM class") or die(mysql_error());                 
                    echo "<select name='lesson'>";
                    while($data = mysql_fetch_array($rs)){
                        echo "<option value='".$data['class_name']."'>".$data['class_name']."</option>";
                    echo "</select>";

                    <td>Date Time</td>                
                    <td><input type="text" id="datedate" name="datetime" value="<?php echo $datetime; ?>" rows="4" cols="50"></td>

                    $rs = mysql_query("SELECT * FROM exercise") or die(mysql_error());                  
                    echo "<select name='exercise'>";
                    while($data = mysql_fetch_array($rs)){
                        echo "<option value='".$data['class_name']."'>".$data['class_name']."</option>";
                    echo "</select>";

                    <td><input type="text" size="50px" name="weakness" value="<?php echo $weakness; ?>"></td>
                    <td><input type="text" size="50px" name="progress" value="<?php echo $progress; ?>"></td>
                    <td>Teacher Advice</td>
                    <td><input type="text" size="50px" name="teacher_advice" value="<?php echo $teacher_advice; ?>"/></td>
                    <td><input type="text" size="5px" name="homework" value="<?php echo $homework; ?>"/></td>
                    <td><input type="text" size="5px" name="listening" value="<?php echo $listening; ?>"/></td>
                    <td><input type="text" size="5px" name="Grammar" value="<?php echo $grammar; ?>"/></td>
                    <td><input type="text" size="5px" name="conversation" value="<?php echo $conversation; ?>"/></td>
                    <td><input type="text" size="5px" name="reading" value="<?php echo $reading; ?>"/></td>
                    <td><br><input type="submit" name="ok" value="Save" class="abutton"/></td>              


<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 99:99:99",{completed:function(){alert("completed!");}});
    $("input").blur(function() {
    $("#info").html("Unmasked value: " + $(this).mask());
    }).dblclick(function() {

<p> </p>

<?php include('../adminfooter.php'); ?>
2 Years
Discussion Span
Last Post by scudzilla

Line 164 uses $student_id but $student_id may not have been declared. This occurs when line 138 condition is false.

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.