Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2007, 03:38 AM
Authorized User
 
Join Date: Jan 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to syazlan
Default coding php which link that i want to view a form

aii all....
i wan to ask u all,
i have 1 form which had view the list of members..here i have name,kategory,n so on.Category is Pensyarah,Kakitangan Kump A,kakitangan Kump B and Kakitangan Kump C & D, when the list of the member viewed,i want at the categori,i can link to the form which is
if category=Pensyarah, the form of yuran1 can view..
else category=Kakitangan Kump B,the form of yuran 2 can view..

here i'll giv u my code
(code for view the list of the member)& (coding my form,yuran_bulanan n yuran_bulanan1)
[bold code is wrong,i did'n know to try againt]

<?php
include("../php/connect.php");
$result1 = mysql_query("SELECT * FROM pendaftaran_ahli WHERE id");
$sql1 = mysql_fetch_array( $result1 );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
    font-size: 12px;
    font-weight: bold;
}
a:link {
    color: #000000;
}
a:visited {
    color: #000000;
}
a:hover {
    color: #000000;
}
a:active {
    color: #000000;
}
-->
</style>
</head>

<body>
<p align="center" class="style1"> SENARAI AHLI KELAB KAKITANGAN PUSAT PENGAJIAN SAINS KESIHATAN</p>
<p align="center" class="style1"> UNIVERSITI SAINS MALAYSIA CAWANGAN KELANTAN</p>

<?php
if(!isset($_GET['page'])){
    $page = 1; }
else {
$page = $_GET['page'];
}
$max_results = 35;
$from = (($page * $max_results) - $max_results);
$sql = mysql_query("SELECT * FROM pendaftaran_ahli order by nama LIMIT $from, $max_results");
$row = mysql_num_rows($sql);
if ($row == 0) {
echo "<form><table width='42%' height='65' border='0' align='center'>
  <tr>
    <td><div align='center'>Maaf,
        tiada rekod!</div></td>
  </tr>
</table><form>\n";

 } else {

    echo "<div align='left'>Sila pilih halaman</div><br/>";
    echo "<form name='frmSample' method='post' action='../php/delete_senaraiahli.php' onSubmit='return ValidateForm(this,'delete[]')'>";
    echo "<TABLE ALIGN='CENTER' BORDER='1' width='100%' border='1' cellpadding='1' cellspacing='1' bordercolor='' class='ayu'>";
      echo "<TR>
            <TH width='15%'><div align='center'><strong>NAMA</strong></div></td>
            <TH width='5%'><div align='center'><strong>KATEGORI</strong></div></td>
            <TH width='5%'><div align='center'><strong>ID STAF</strong></div></TH>
            <TH width='5%'><div align='center'><strong>KATA LALUAN</strong></div></TH>
            <TH width='5%'><div align='center'><strong>YURAN BULANAN</strong></div></TH>
            <TH width='5%'><div align='center'>Kemaskini</div></TH>
            <TH width='5%'><div align='center'><input class='butang' type='submit' name='submit' value='Buang'></div></TH>
         </TR>";
         while ($row=mysql_fetch_array($sql))
{
//$id=$row["Bil"];
$nama=$row["nama"];
$yuran=$row["yuran"];
$kategori=$row["kategori"];
$id=$row["id"];
$kata_laluan=$row["kata_laluan"];
    echo "<TR>
              <TD><div align='left'>$nama</div></TD>
            <TD><div align='left'>$kategori</div></TD>
            if($kategori==Pensyarah){
            <a href='yuran_bulanan.php'>$kategori</a>
            }
            else if($kategori==Kakitangan Kump A){
            <a href='yuran_bulanan1.php'>$kategori</a>
            }
             <TD><div align='center'>$id</div></TD>
            <TD><div align='center'>$kata_laluan</div></TD>
            <TD><div align='center'>$yuran</div></TD>
            <TD><div align='center'><a href='update_takwim.php?nama=$nama'><img src='../images/kemaskini.gif' width='14' height='14' border='0'></a></div></TD>
              <TD><div align='center'><input type='checkbox' name='delete[]' value='$nama'></div></TD>
           </TR>";

}
}

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM pendaftaran_ahli"),0);
$total_pages = ceil($total_results / $max_results);
if($page > 1){
    $prev = ($page - 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Sebelumnya</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
    if(($page) == $i){
        echo "$i ";
        } else {
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
    }
}
if($page < $total_pages){
    $next = ($page + 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Seterusnya>></a>";
}
echo "</center>";
?>
</table>
</form>
</body>
</html>


(coding for yuran_bulanan=RM 5.00 n yuran_bulanan1=Rm 4.00)

<!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">
<!--
.style7 {font-size: 12px}
-->
</style>
</head>

<body><form name="daftar" action="../php/yrnblnn_pensyarah.php" method="post" target="daftar_ahli">
<table width="444" border="0" align="center">
  <tr>
      <th width="434" height="48" bordercolorlight="#003300"><span class="style5">.::Senarai
        Yuran Bulananan::.</span></th>
    </tr>
</table>
  <table width="100" border="0" align="center">
      <th width="700%" colspan="1" align="left" valign="top" scope="row">TAHUN</th>

      <td width="30%" align="left" valign="top"><input type="text" name="tahun" size="4" maxlength="4"></td>
    </tr>
</table>

  <table width="400" border="0" align="center">
    <tr>
      <th colspan="13" align="center" valign="top" scope="row">&nbsp;</th>
    </tr>
    <tr bgcolor="#FFFF00">
      <th width="15%" align="left" valign="top" scope="row">Bulan</th>
      <td width="10%" align="center" valign="top">Jan</td>
      <td width="10%" align="center" valign="top">Feb</td>
      <td width="10%" align="center" valign="top">Mac</td>
      <td width="10%" align="center" valign="top">Apr</td>
      <td width="10%" align="center" valign="top">May</td>
      <td width="10%" align="center" valign="top">Jun</td>
    </tr>
    <tr bgcolor="#FFFF00">
      <th width="15" align="left" valign="top" scope="row">Bayaran
     </th>
      <td width="10" align="center" valign="top">
        <select name="jan" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
      <select name="feb" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
   <select name="mac" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
       <select name="april" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
     <select name="may" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
       <select name="jun" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
    </tr>
  </table>
  <table width="400" border="0" align="center">
    <tr>
      <th colspan="13" align="center" valign="top" scope="row">&nbsp;</th>
    </tr>
    <tr bgcolor="#FFFF00">
      <th width="15%" align="left" valign="top" scope="row">Bulan</th>
      <td width="10%" align="center" valign="top">Julai</td>
      <td width="10%" align="center" valign="top">Ogos</td>
      <td width="10%" align="center" valign="top">Sept</td>
      <td width="10%" align="center" valign="top">Oktb</td>
      <td width="10%" align="center" valign="top">Nov</td>
      <td width="10%" align="center" valign="top">Dis</td>
    </tr>
    <tr bgcolor="#FFFF00">
      <th width="15" align="left" valign="top" scope="row">Bayaran
     </th>
      <td width="10" align="center" valign="top">
        <select name="julai" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
      <select name="ogos" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
   <select name="sept" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
       <select name="oktb" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
     <select name="nov" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
      <td width="10" align="center" valign="top">
       <select name="dis" id="select" >
        <option value="RM 5.00">RM 5.00</option>
      <option value=""></option>
        </select></td>
    </tr>
  </table>
  <table width="200" border="0" align="center">
    <th width="127" height="" bordercolorlight="#003300">
      <th colspan="3" align="left" valign="top" scope="row">&nbsp;</th>
    <tr bgcolor="#999999">
      <th colspan="1" align="left" valign="top" scope="row">Jumlah</th>
      <td width="10" align="left" valign="top"><strong>:</strong></td>
      <td width="49" align="left" valign="top">&nbsp;</td>

    </tr>

    <tr bgcolor="#999999">
      <th colspan="1" align="left" valign="top" scope="row">
        <div align="left">Baki
          Tertunggak</div></th>
      <td width="10" align="left" valign="top"><strong>:</strong></td>
      <td width="49" align="left" valign="top">&nbsp;</td>
</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>









Similar Threads
Thread Thread Starter Forum Replies Last Post
How to view picture by using form view? mysecondlove ASP.NET 2.0 Basics 1 April 8th, 2008 07:17 AM
create database in mysql through php coding vivekananth PHP Databases 2 January 31st, 2007 01:48 AM
How can i delete multiple row through PHP coding taha_elearner PHP Databases 1 October 28th, 2005 05:33 AM
Questions regaring PHP Coding phpcoder1 PHP How-To 0 November 4th, 2004 05:02 PM
Questions regaring PHP Coding phpcoder1 Beginning PHP 1 September 11th, 2004 08:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.