0

i have this recommendation that, the teacher can add continuously how can i do this?
in which the teacher can add grade and on single button it can be all saved in one database
http://www.4shared.com/photo/TjiwnmxX/aaa.html?refurl=d1forum

<?php
	if(isset($_POST['save']))
	{
	$g_year['acad_id'];
	$fg=$_POST['fg'];
	$sg=$_POST['sg'];
	$tg=$_POST['tg'];
	$forg=$_POST['forg'];
	for($i=0;$i<count($fg) && $i<count($sg) && $i<count($tg) && $i<count($forg);$i++){
	$first = $fg[$i];
	$sec = $sg[$i];
	$tir = $tg[$i];
	$for = $forg[$i];
	$f_subj=mysql_query("select * from tbl_grades where firstgrading='$first' && secondgrading='$sec' && thirdgrading='$tir' && fourthgrading='$for'")or die(mysql_error());
	$g_subj=mysql_fetch_array($f_subj);
	if($g_subj==0)
	{
	mysql_query("insert into tbl_grades set firstgrading='$fg', secondgrading='$sg', thirdgrading='$tg', $fourthgrading='$for'")or die (mysql_error());
	}
	}
	}
?>

this the html

<?php
	$query = mysql_query("select * from students, stud_subject, tc_handle where tc_handle.secid = stud_subject.secid and tc_handle.sid = '$_SESSION[sid]' and tc_handle.sub_id = '$_GET[view]' and students.id = stud_subject.id and stud_subject.sub_id = tc_handle.sub_id and stud_subject.remark=''");
while ($row = mysql_fetch_array($query)){
?>
<form action="tc_addall.php" method="post">
<?php
	$f_name = $row['lastname'].' ,&nbsp;'.$row['firstname'].$row['middlename'].'<br>';
	echo '<p class="name">'.$f_name.'</p>';
	echo $row['id'];
?>
 <p class="oo">
 <input name="fg[]" type="text" id="fg[]" size="1"/>
 <input name="sg[]" type="text" id="sg[]" size="1"/>
 <input name="tg[]" type="text" id="tg[]" size="1"/>
 <input name="forg[]" type="text" id="forg[]" size="1"/>

 </p>

<?php $a=$a+1;}?>
Attachments aaa.png 132.61 KB
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
0

Topless teachers!! Ughh - don't feel so good...

So what's the problem? Just place all the stuff into one form. I haven't checked the code BTW, just moved things around:

<form action="tc_addall.php" method="post">
<?php
	$query = mysql_query("select * from students, stud_subject, tc_handle where tc_handle.secid = stud_subject.secid and tc_handle.sid = '$_SESSION[sid]' and tc_handle.sub_id = '$_GET[view]' and students.id = stud_subject.id and stud_subject.sub_id = tc_handle.sub_id and stud_subject.remark=''");
while ($row = mysql_fetch_array($query)){
?>
<?php
	$f_name = $row['lastname'].' ,&nbsp;'.$row['firstname'].$row['middlename'].'<br>';
	echo '<p class="name">'.$f_name.'</p>';
	echo $row['id'];
?>
 <p class="oo">
 <input name="fg[<?php echo $row['id'];?>]" type="text" id="fg_<?php echo $row['id'];?>" size="1"/>
 <input name="sg[<?php echo $row['id'];?>]" type="text" id="sg_<?php echo $row['id'];?>" size="1"/>
 <input name="tg[<?php echo $row['id'];?>]" type="text" id="tg_<?php echo $row['id'];?>" size="1"/>
 <input name="forg[<?php echo $row['id'];?>]" type="text" id="forg_<?php echo $row['id'];?>" size="1"/>
 </p>
 
<?php $a=$a+1;}?>
<....submit button....>
</form>
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.