0

Hi all,

My requirement is to add student marks into the system. In my form i have entered admission number of the student, term and year and click on "Add" button to enter marks. Thereafter the page should be redirected to the following page where it should be displayed marks. But instead it generates following error. Can anyone help me out to resolve the issue?

Notice: Use of undefined constant mark - assumed 'mark' in C:\wamp\www\Student marks\add student marks\addStudentMarkForm.php on line 207

<?php

$query="SELECT name_with_initial FROM student_info
WHERE student_info.admission_no='$admission_no'";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){
echo $row['name_with_initial'];
}
?>
</td>
        <td colspan="2">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><label>Grade</label>&nbsp;</td>
        <td width="74" >


<?php 
$query="SELECT class.grade_id FROM class INNER JOIN student_class ON class.class_id=student_class.class_id
WHERE student_class.admission_no='$admission_no' and student_class.year='$year'" ;
$result=mysql_query($query);
     while($row=mysql_fetch_array($result)){
 $grade_id=$row['grade_id'];
     }
     $query="SELECT grade FROM grade 
WHERE grade_id='$grade_id'" ;
$result=mysql_query($query);
     while($row=mysql_fetch_array($result)){
 echo $row['grade'];
     }
?></td>
        <td width="82" align="center"><label><label>Class</label> 
</label></td>
        <td width="78"><?php 
       $query="SELECT class.class_name FROM class INNER JOIN student_class ON class.class_id=student_class.class_id
WHERE student_class.admission_no='$admission_no' and student_class.year='$year'" ;
$result=mysql_query($query);
     while($row=mysql_fetch_array($result)){
 echo $row['class_name'];
     }
?></td>
        <td width="67" align="center"><label>Stream </label>&nbsp;</td>
        <td>
<?php 

$query="SELECT class.stream FROM class INNER JOIN student_class ON class.class_id=student_class.class_id
WHERE student_class.admission_no='$admission_no' and student_class.year='$year'" ;
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
echo $row['stream'];
     }
?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="6"><table width="444" border="1">
        <?php


        $query="select class.grade_id from class inner join student_class on class.class_id=student_class.class_id
        where  student_class.admission_no='$admission_no' and student_class.year='$year'";

     $result=mysql_query($query);
     while($row=mysql_fetch_array($result)){
     $grade_id=$row['grade_id'];
     }   

    //accoring to the grade id gets subject id

        $query="select subject.subject_id from subject inner join subject_category on subject.subject_id=subject_category.subject_id
              where subject.subject_id like '$grade_id/%' and subject_category.only_time_table='no' and subject.not_available='no'";

        $result=mysql_query($query);

        $t=0;
     while($row=mysql_fetch_array($result)){
         $t++;
$subject_i[$t]=$row['subject_id'];
     }   

    //According to the subject id gets name


                for ($i=1;$i<=$t;$i++)
            {
                $query1 = "select name from subject where subject_id='".$subject_i[$i]."'";
                $result1=mysql_query($query1);

                while($row1=mysql_fetch_array($result1)){

                     $name[$i]=$row1['name'];
                 }
                 }






     ?>
          <tr>
            <td width="84" height="28" align="center"><label><strong>Number</strong></label>              &nbsp;</td>
            <td width="224" align="center"><label><strong>Subject</strong></label>
              <strong>&nbsp;</strong></td>
            <td width="120" align="center"><?php echo $term;?></td>
          </tr>
          <?php

          $x=0; 

            for($y=1;$y<=$t;$y++){
                $x++;
              echo "<tr>";
           echo "<td>".$subject_i[$y]."</td>";
            echo "<td>".$name[$y]."</td>";?>

            **//Line 207
            <td><input type='text' name='<?php echo mark.$y; ?>' id='textfield' /></td>**
           <?php echo "</tr>";

        $subject_id[$y]=$subject_i[$y];

            }?>
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by heshanm
0

Well you are echoing something that either should be wrapped in quotes or need to make it a variable. You have

<td><input type='text' name='<?php echo mark.$y; ?>' id='textfield' /></td>

Possibilities

<td><input type='text' name='<?php echo "mark". $y; ?>' id='textfield' /></td>
<td><input type='text' name='<?php echo "mark $y"; ?>' id='textfield' /></td>
This question has already been answered. 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.