| | |
post problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 16
Reputation:
Solved Threads: 0
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.
this form name 4.php
this is form 2.php.
php Syntax (Toggle Plain Text)
<?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    n/15"; echo"<td width='80'> UJIAN 2    n/15"; echo"<td width='90'> TUGASAN    n/15"; echo"<td width='70'> KUIZ    n/5"; echo"<td width='70'> CARRY MARK    n/50"; echo"<td width='60'> Final Exam    n/50"; echo"<td width='60'> Jumlah    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>        <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 Syntax (Toggle Plain Text)
<?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    n/15"; echo"<td width='80'> UJIAN 2    n/15"; echo"<td width='90'> TUGASAN    n/15"; echo"<td width='70'> KUIZ    n/5"; echo"<td width='70'> CARRY MARK    n/50"; echo"<td width='60'> Final Exam    n/50"; echo"<td width='60'> Jumlah    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>        <button type='submit' align='center' name='Button'><img src='images/cancel.png' alt='padam' align='center' width='40' height='40'>"; ?>
Last edited by peter_budo; Apr 11th, 2008 at 9:18 pm. Reason: Keep It Organized - plase use [code] tags
ya u have written the code like tat.
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
PHP Syntax (Toggle Plain Text)
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
![]() |
Other Threads in the PHP Forum
- Previous Thread: Frontpage+PHP+JavaScript, help!!!
- Next Thread: CHECKBOX VAILDATION CODE not working
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





