hello..i have a problem when i try to post the value from form 2.php to form 4.php..this form name 2.php..i make a table in this form.the problem is, i cannot post all the value that i wrote, it just take the last value for the proccess..anybody?..plz help me..u can try run dis coding..im not very good in english to explain..tq

this is form 2.php.

<?php

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("kptm", $con);
$result = mysql_query("SELECT * FROM student ORDER BY NAMA");



   
echo"<form name='kptm' form method='POST' action='4.php'>";
echo"<h1 align='center'> Student Statement</h1>";



  echo"<table border='2'align='center'>";
  echo"<p align='center'>SUBJECT : UNIX (TK 213)";
  echo "<tr> ";
  echo"<p align='center'>";
  echo"<td width='20'>Bil";
  echo"<td width='230'> Nama Pelajar";
  echo"<td width='100'> Ic Pelajar";
  echo"<td width='80'> UJIAN 1 &nbsp&nbsp n/15";
  echo"<td width='80'> UJIAN 2 &nbsp&nbsp  n/15";
  echo"<td width='90'> TUGASAN &nbsp&nbsp  n/15";
  echo"<td width='70'> KUIZ &nbsp&nbsp  n/5";
  echo"<td width='70'> CARRY MARK &nbsp&nbsp n/50";
  echo"<td width='60'> Final Exam &nbsp&nbsp  n/50";
  echo"<td width='60'> Jumlah &nbsp&nbsp  n/100";
  echo"</tr>";
  echo"</table>";
  


  for ($i=1;$i<=10; $i++)
{

  
  echo"<table border='2'align='center'>";
 

while ($row = mysql_fetch_array($result)) 
{   
	echo "<tr> ";
 
  $Nama = $row["NAMA"];
  $Ic = $row["IC"];
 
 
 echo"<td width='18'>$i";
 
 echo"<td width='230'><input type=text name=nama value='$Nama' size=35 maxlength=5  >\t ";
echo"<td width='100'><input type=text name=nama value='$Ic' size=12 max length=5  >\t ";
echo"<td width='80'><input type=text name=ujian1  size=9 max length=5  >\t ";
 echo"<td width='80'><input type=text name=ujian2  size=9 max length=5 >\t ";
 echo"<td width='90'><input type=text name=tugasan  size=11 max length=5 >\t ";
 echo"<td width='70'><input type=text name=kuiz size=6 max length=5  >\t ";
 echo"<td width='70'><input type=text name=carry size=8 ><br/> ";
 echo"<td width='60'><input type=text name=final size=6 ><br/> ";
  echo"<td width='60'><input type=text name=final2 size=6 ><br/> ";
	
   echo"</tr>";
   
   echo"</tr>";

}
   echo"</table>";
  
}



echo"<p align='center'><button type='submit' align='center' name='Button'><img src='images/apply.png' alt='save' align='center' width='40' height='40'></button>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<button type='submit' align='center' name='Button'><img src='images/cancel.png' alt='save' align='center' width='40' height='40'>";


?>

this form name 4.php

<?php
$Final2=null;
$gred=null;


	 
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("kptm", $con);
$result = mysql_query("SELECT NAMA FROM student ORDER BY NAMA");


$Nama=$_POST["nama"];
$Ujian1=$_POST["ujian1"];

$Ujian2=$_POST["ujian2"];

$Tugasan=$_POST["tugasan"];

$Kuiz=$_POST["kuiz"];
$Final=$_POST["final"];




$carry = $Ujian1+$Ujian2+$Tugasan+$Kuiz;
$Final2= $carry+$Final;

   
echo"<form name='kptm' form method='POST' >";
echo"<h1 align='center'> Penyata Markah Peperiksaan Akhir</h1>";



   echo"<table border='2'align='center'>";
  echo"<p align='center'>SUBJEK : SISTEM UNIX (TK 213)";
  echo "<tr> ";
     echo"<p align='center'>";
   echo"<td width='20'>Bil";
  echo"<td width='230'> Nama Pelajar";
  echo"<td width='80'> UJIAN 1 &nbsp&nbsp n/15";
  echo"<td width='80'> UJIAN 2 &nbsp&nbsp  n/15";
  echo"<td width='90'> TUGASAN &nbsp&nbsp  n/15";
  echo"<td width='70'> KUIZ &nbsp&nbsp  n/5";
  echo"<td width='70'> CARRY MARK &nbsp&nbsp n/50";
  echo"<td width='60'> Final Exam &nbsp&nbsp  n/50";
  echo"<td width='60'> Jumlah &nbsp&nbsp  n/100";
    echo"<td width='60'> Gred ";
  echo"</tr>";
  echo"</table>";
  


 for ($i=1; $i<=18; $i++)
{
  echo"<table border='2'align='center'>";
  while ($row = mysql_fetch_array($result)) 
{   

	echo "<tr> ";
 
  $Nama = $row["NAMA"];
 

 
  if (($Final2 > 0) && ($Final2 <= 39))
	  {
	  $gred='F';
	  }
 else if (($Final2 >= 40 ) && ($Final2 <= 49))
	  {
	  $gred='D';
	  }
 else if (($Final2 >= 50) && ($Final2 <= 54))
	  {
	  $gred='C+';
	  }
 else if (($Final2 >=55) && ($Final2 <= 59))
	  {
	 $gred='C';
	  }  
 else if (($Final2 >= 60) && ($Final2 <= 64))
	  {
	  $gred='B-';
	  }
 else if (($Final2 >=65) && ($Final2 <= 69))
	  {
	  $gred='B';
	  }
 else if (($Final2 >=70) && ($Final2 <= 74))
	  {
	  $gred='B+';
	  }
 else if (($Final2 > 74) && ($Final2 <85))
	  {
	  $gred= 'A-';
	  }
 else if(($Final2 > 85) && ($Final2 <= 100))
	 {
	 $gred='A';
	 }
	

   echo "<tr> ";
  

   echo"<td width='18'>$i";

  echo"<td width='230'><input type=text name=nama".$i." value='$Nama' size=34 max length=5  >\t ";
   echo"<td width='80'><input type=text name=ujian1".$i." value='$Ujian1' size=10 max length=5  >\t ";
   echo"<td width='80'><input type=text name=ujian2".$i." value='$Ujian2'size=9 max length=5 >\t ";
   echo"<td width='90'><input type=text name=tugasan".$i." value='$Tugasan'size=11 max length=5 >\t ";
     echo"<td width='70'><input type=text name=kuiz".$i." value='$Kuiz'size=6 max length=5  >\t ";
   echo"<td width='70'><input type=text name=carry".$i." value='$carry' size=8 ><br/> ";
     echo"<td width='60'><input type=text name=final value='$Final' size=6 ><br/> ";
      echo"<td width='60'><input type=text name=final2 value='$Final2' size=6 ><br/> ";
	    echo"<td width='60'><input type=text name=gred value='$gred' size=6 ><br/> ";
		
   echo"</tr>";
   
   echo"</tr>";
 
}
   echo"</table>";
       
 }



echo"<p>";
echo"<p>";
echo"<p align='center'><button type='submit' align='center' name='Button'><img src='images/apply.png' alt='save' align='center' width='40' height='40'></button>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<button type='submit' align='center' name='Button'><img src='images/cancel.png' alt='padam' align='center' width='40' height='40'>";


?>

ya u have written the code like tat.

for ($i=1;$i<=10; $i++)
{
echo"<table border='2'align='center'>";
while ($row = mysql_fetch_array($result)) 
{ 
echo "<tr> ";
$Nama = $row["NAMA"];
$Ic = $row["IC"];
echo"<td width='18'>$i";

to my knowledge only after the loop execution the data will be sent to the next page,
$nama,$Ic value will be changing ...the last value will get stored when u try to post the data

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.