Jump to content

Please help, i can't solve this problem.


june_c21

Recommended Posts

i got this problem when i try to click on edit button, it point to id=month instead of id=number. why this happen? i can't find any error with this code. pls help

 

below is my code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>KEV Travelling Claim</title>
<link rel="stylesheet" href="http://www.zapatec.com/website/main/../ajax/zpcal/themes/winter.css"  />
<style type="text/css">
<!--
.style8 {font-family: Arial; font-weight: bold; font-size: 14px; }
body {
background-color: #FFFF99;
}
.style12 {font-family: Arial; font-weight: bold; font-size: 12px; color: #FF3300; }
.style13 {
font-family: Arial;
font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="http://www.zapatec.com/website/main/../ajax/zpcal/../utils/zapatec.js"></script>
    <script type="text/javascript" src="http://www.zapatec.com/website/main/../ajax/zpcal/src/calendar.js"></script>
<!-- Loading language definition file -->
    <script type="text/javascript" src="http://www.zapatec.com/website/main/../ajax/zpcal/lang/calendar-en.js"></script>

</head>
<?php


$host = 'localhost';
$user = 'root';
$password = 'admin';
$dbase = 'claim';

$dblink = mysql_connect($host,$user,$password);
mysql_select_db($dbase,$dblink);
$id = $_GET['id'];
$query = "SELECT id,month,start_date,end_date,staff_no,details,amount,gl_code,bank,acc_no FROM report WHERE id=$id ";
$result = mysql_query($query, $dblink);

while($myrow = mysql_fetch_row($result))
  {
  $id = $myrow [0];
  $month = $myrow [1];
  $start_date = $myrow[2];
  $end_date = $myrow[3];
  $staff_no = $myrow[4];
  $details = $myrow[5];
  $amount = $myrow[6];
  $gl_code = $myrow[7];
  $bank = $myrow[8];
  $acc_no=$myrow[9];
  }
?>
<body>
<p class="style8"> </p>
<form id="form1" name="form1" method="post" action="edit.php?id=<?php echo $id ?>">
  <label></label>
  <p>
    <label></label>
  <span class="style13">KEV Travelling Claim  </span></p>
  <table width="516" height="138" border="0">
    <tr>
      <td class="style12">Month</td>
      <td><select name="month" id="month">
        <option>OCT</option>
        <option>NOV</option>
        <option>DEC</option>
      </select></td>
    </tr>
    <tr>
      <td><span class="style12">Start Date </span></td>
      <td><input type="text" id="start_date" name="start_date" value=<?php echo $start_date ?> />
          <button id="trigger">Calendar</button>
        <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        firstDay          : 1,
        electric          : false,
        inputField        : "start_date",
        button            : "trigger",
        ifFormat          : "%Y-%m-%d",
        daFormat          : "%Y-%m-%d"
      });
    //]]></script>
      </td>
    </tr>
    <tr>
      <td><span class="style12">End Date </span> </td>
      <td><input name="end_date" type="text" id="end_date" value=<?php echo $end_date ?> />
          <button id="trigger1">Calendar</button>
        <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        firstDay          : 1,
        electric          : false,
        inputField        : "end_date",
        button            : "trigger1",
        ifFormat          : "%Y-%m-%d",
        daFormat          : "%Y-%m-%d"
      });
    //]]></script>
      </td>
    </tr>
    <tr>
      <td class="style12"><p>Staff No. </p></td>
      <td><input name="staff_no" type="text" id="staff_no" value=<?php echo $staff_no ?>/></td>
    </tr>
    <tr>
      <td class="style12">Details</td>
      <td><textarea name="details" id="details"><?php echo $details ?></textarea></td>
    </tr>
    <tr>
      <td><span class="style12">
        <label>Amount</label>
      </span></td>
      <td><input name="amount" type="text" id="amount" value=<?php echo $amount ?> /></td>
    </tr>
    <tr>
      <td><span class="style12">
        <label>GL Code </label>
      </span></td>
      <td><select name="gl_code">
          <option>45725   Mileage Claim</option>
          <option>45730  Parking & Toll Charges</option>
          <option>45740  Airfares - Local Overseas</option>
          <option>45750 Taxi - Local & Overseas</option>
          <option>45780  Staff Travel Costs - Hotels</option>
          <option>45790  Staff Travel Costs - Subsistence</option>
          <option>45800  Special Mileage Claims</option>
        </select>
      </td>
    </tr>
    <tr>
      <td class="style12">Bank</td>
      <td><select name="bank" id="bank">
        <option>Maybank</option>
        <option>CIMB</option>
      </select></td>
    </tr>
    <tr>
      <td class="style12">Bank Account No. </td>
      <td><input name="acc_no" type="text" id="acc_no" value=<?php echo $acc_no ?> /></td>
    </tr>
  </table>

  <p>
    <label>
    <input type="submit" name="Submit" value="Update" />
    </label>
  </p>
</form>
<p> </p>
</body>
</html>

EDIT by zanus:please use code tags

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.