Sleir Posted February 28, 2007 Share Posted February 28, 2007 this coding when i submit to database,its ok but when i try to leave one or more choice,its view an error..?why rrrr? here i giv my coding...:coding form for YURAN<? include("../php/connect.php");session_start();$id = $_GET['id'];$_SESSION['id'] = $id;if($id) // jika ic tu ade{ $query = "SELECT * FROM pendaftaran_ahli WHERE id='$id'"; $result = mysql_query($query); if($result) //jika sql berjaya { while( $row = mysql_fetch_array($result)) { $id = $row['id']; $nama=$row['nama']; }?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"><!--.style9 {font-size: 12px}.style10 {color: #FF0000}--></style></head><body><form name="daftar" action="../php/hantar_yuranC.php" method="post" target="PPSK"><table width="444" border="0" align="center"> <tr> <th width="434" height="48" bordercolorlight="#003300"><span class="style5">.:: Senarai Yuran Bulananan <? echo $nama; $_SESSION['nama']=$nama; ?> <input type="hidden" name="id" value="<? echo $id; ?>">::.</span></th> </tr></table> <table width="100" border="0" align="center"> <th width="700%" colspan="1" align="left" valign="top" scope="row"><font color="#FF0000">TAHUN</font></th> <td width="30%" align="left" valign="top"><input type="text" name="tahun" size="4" maxlength="4"></td> </tr></table> <table width="100%" border="0" align="center"> <tr> <th colspan="13" align="center" valign="top" scope="row"> </th> </tr> <tr bgcolor="#FFFF00"> <th width="68" align="left" valign="top" scope="row">Bulan</th> <td width="113" align="center" valign="top">Jan</td> <td width="111" align="center" valign="top">Feb</td> <td width="105" align="center" valign="top">Mac</td> <td width="108" align="center" valign="top">Apr</td> <td width="115" align="center" valign="top">May</td> <td width="114" align="center" valign="top">Jun</td> </tr> <tr bgcolor="#FFFF00"> <th width="68" align="left" valign="top" scope="row">Bayaran </th> <td width="113" align="center" valign="top" class="style9"> <div align="left"> <input name="jan" type="radio" value="2.00"/>Bayar<br> <input name="jan" type="radio" value="0.00"/>Tidak Bayar</div></td> <td width="111" align="center" valign="top" class="style9"><div align="left"> <input name="feb" type="radio" value="2.00"/>Bayar<br> <input name="feb" type="radio" value="0.00"/>Tidak Bayar</div></td> <td width="105" align="center" valign="top" class="style9"><div align="left"> <input name="mac" type="radio" value="2.00"/>Bayar<br> <input name="mac" type="radio" value="0.00"/>Tidak Bayar</div></td> <td width="108" align="center" valign="top" class="style9"><div align="left"> <input name="april" type="radio" value="2.00"/>Bayar<br> <input name="april" type="radio" value="0.00"/>Tidak Bayar</div></td> <td width="115" align="center" valign="top" class="style9"><div align="left"> <input name="may" type="radio" value="2.00"/>Bayar<br> <input name="may" type="radio" value="0.00"/>Tidak Bayar</div></td> <td width="114" align="center" valign="top" class="style9"><div align="left"> <input name="jun" type="radio" value="2.00"/>Bayar<br> <input name="jun" type="radio" value="0.00"/>Tidak Bayar</div></td> </tr> </table> <table width="100%" border="0" align="center"> <tr> <th colspan="13" align="center" valign="top" scope="row"> </th> </tr> <tr bgcolor="#FFFF00"> <th width="68" align="left" valign="top" scope="row">Bulan</th> <td width="113" align="center" valign="top">Julai</td> <td width="111" align="center" valign="top">Ogos</td> <td width="105" align="center" valign="top">Sept</td> <td width="108" align="center" valign="top">Oktb</td> <td width="115" align="center" valign="top">Nov</td> <td width="114" align="center" valign="top">Dis</td> </tr> <tr bgcolor="#FFFF00"> <th width="68" align="left" valign="top" scope="row">Bayaran </th> <td width="113" align="center" valign="top" class="style9"><div align="left"> <input name="julai" type="radio" value="2.00"/>Bayar<br> <input name="julai" type="radio" value="0.00"/> Tidak Bayar</div></td> <td width="111" align="center" valign="top" class="style9"><div align="left"> <input name="ogos" type="radio" value="2.00"/>Bayar<br> <input name="ogos" type="radio" value="0.00"/> Tidak Bayar</div></td> <td width="105" align="center" valign="top" class="style9"><div align="left"> <input name="sept" type="radio" value="2.00"/>Bayar<br> <input name="sept" type="radio" value="0.00"/> Tidak Bayar</div></td> <td width="108" align="center" valign="top" class="style9"><div align="left"> <input name="oktb" type="radio" value="2.00"/>Bayar<br> <input name="oktb" type="radio" value="0.00"/> Tidak Bayar</div></td> <td width="115" align="center" valign="top" class="style9"><div align="left"> <input name="nov" type="radio" value="2.00"/>Bayar<br> <input name="nov" type="radio" value="0.00"/> Tidak Bayar</div></td> <td width="114" align="center" valign="top" class="style9"><div align="left"> <input name="dis" type="radio" value="2.00"/>Bayar<br> <input name="dis" type="radio" value="0.00"/> Tidak Bayar</div></td> </tr> </table> <table width="30" border="0" align="center"> <th width="30%" colspan="1" align="left" valign="top" scope="row"> <input type="submit" name="Submit" value="Hantar"></th></table></form></body></html><? }}?>Coding for submit<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><style type="text/css"><!--.style1 { font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold;}--></style><?phpinclude 'connect.php';$tarikh = date ("j M, Y")." ".date("g: i a");$id = $_POST['id'];$tahun=$_POST['tahun'];$jan=$_POST["jan"];$feb=$_POST["feb"];$mac=$_POST["mac"];$april=$_POST["april"];$may=$_POST["may"];$jun=$_POST["jun"];$julai=$_POST["julai"];$ogos=$_POST["ogos"];$sept=$_POST["sept"];$oktb=$_POST["oktb"];$nov=$_POST["nov"];$dis=$_POST["dis"]; if($tahun == "") { echo "<script language='JavaScript'>alert('Sila Masukkan Tahun Bayaran Yuran Bulanan'); </script>"; echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];">'; } else if($jan == "") { echo "<script language='JavaScript'>alert('Sila Pastikan Pembayaran Yuran Setiap Bulan'); </script>"; echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];">'; } else if($tahun && $jan && $id) { //jika semuanya ok//else if($tarikh && $matrik && $pass && $vpass && $nama && $nama2 && $ic && $sesi && $kursus && $alamats && $email && $jantina && $bangsa && $tl_hari && $tl_bulan && $tl_tahun && $asal && $hp) { //jika semuanya ok $query="INSERT INTO yuran_c(id,tahun, jan, feb, mac, april, may, jun, julai, ogos, sept, oktb, nov,dis) VALUES ('$id','$tahun','$jan', '$feb', '$mac','$april','$may','$jun','$julai','$ogos','$sept','$oktb','$nov','$dis')"; $result = mysql_query($query); if($result) { // papar mesej sesudah berjaya daftar echo "<script language='Javascript'>alert(' Yuran Bulanan Bagi Tahun $tahun berjaya direkod!');</script>"; echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];">'; } else { echo "<script language='JavaScript'>alert('Yuran Bulanan Bagi Tahun &tahun tidak direkod!'); </script>"; echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];"'; } } else { //jika ada error pada database echo ("<P>Maaf: ". mysql_error() . "</P>"); exit(); } mysql_close();?></body></html> Link to comment Share on other sites More sharing options...
jlhaslip Posted February 28, 2007 Share Posted February 28, 2007 And what error are you getting. It should be included with the topic, please. Link to comment Share on other sites More sharing options...
Sleir Posted February 28, 2007 Author Share Posted February 28, 2007 And what error are you getting. It should be included with the topic, please.da error was view like this:Parse error: parse error, expecting `','' or `';'' in c:\program files\easyphp1-8\www\ppsk\php\hantar_yuranc.php on line 43or i cannot do the coding like that... Link to comment Share on other sites More sharing options...
justsomeguy Posted February 28, 2007 Share Posted February 28, 2007 The error is on these lines:echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];">';You have 4 lines like this, there are 4 errors you need to fix. This is what this line should look like: echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?id=' . $_GET['id'] . '">'; You need to change the other 3 lines to match what this is like. Link to comment Share on other sites More sharing options...
Sleir Posted March 1, 2007 Author Share Posted March 1, 2007 The error is on these lines:echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?$id = $_GET['id'];">';You have 4 lines like this, there are 4 errors you need to fix. This is what this line should look like:echo '<meta http-equiv="refresh" content="0;URL=../antaramuka/yuran_ktgnC.php?id=' . $_GET['id'] . '">'; You need to change the other 3 lines to match what this is like. tq bro..!!but still have an error...this error will view if you do not input the "tahun".can u try it... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 1, 2007 Share Posted March 1, 2007 What does the error say? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now