Odyssey
hcu_prod_edit.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 
6  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
7  // ** Permissions failed
8  // ** redirect to new page
9  header("Location: /hcuadm/hcu_noperm.prg");
10  exit;
11  }
12 
13 $dms_ok=array('home_cu_code'=>'string','form_err'=>'string','hcu_form'=>'string','home_cu_desc'=>'string');
14 dms_import($dms_ok);
15 
16 
17  cu_header("HomeCU Products");
18 ?>
19  <form action="hcu_prod_save.prg" method="post">
20  <?php
21  // Connect to the database - get the team information from the database
22  $query = "select *
23  from cuprodlist
24  where home_cu_code = '$home_cu_code'";
25  $result = db_query($query, $link);
26  // Now fetch the row
27  $cuprod_row = db_fetch_object($result);
28  $num_rows = db_num_rows($result);
29  ?>
30  <p>&nbsp;
31  <p>
32  <?php
33  if (isset($form_err) && strlen($form_err) > 0)
34  printf("\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
35  ?>
36  <table cellpadding="3" cellspacing="0" border="0" width="500" class="dmsbg"><tr><td>
37  <table cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor=white>
38  <tr>
39  <td colspan="2" class="bar" align="center">
40  <?php if($num_rows > 0): ?>
41  EDIT HOME CU PRODUCT
42  <?php else: ?>
43  ADD HOME CU PRODUCT
44  <?php endif; ?>
45  </td>
46  </tr>
47  <tr>
48  <td nowrap align="right" class="hdr">
49  Home CU Product Code:
50  </td>
51  <td nowrap class='dtl'>
52  <?php if ($num_rows == 0): ?>
53  <?php
54  if ( isset($home_cu_code))
55  $cu_info = set_string($home_cu_code);
56  else
57  $cu_info = htmlspecialchars(trim($cuprod_row->home_cu_code));
58  ?>
59  <input type="text" name="home_cu_code" size="10" maxlength="10" value="<?php echo $cu_info ?>">
60  <input type="hidden" name="hcu_form" value="1">
61  <?php else: ?>
62  <?php echo $cuprod_row->home_cu_code ?>
63  <input type="hidden" name="home_cu_code" value="<?php echo htmlspecialchars(trim($cuprod_row->home_cu_code)) ?>">
64  <?php endif; ?>
65  </td>
66  </tr>
67  <tr>
68  <td nowrap align="right" class="hdr">
69  Product Description:
70  </td>
71  <td nowrap class='dtl'>
72  <?php
73  if ( isset($home_cu_desc))
74  $cu_info = set_string($home_cu_desc);
75  else
76  $cu_info = htmlspecialchars(trim($cuprod_row->home_cu_desc));
77  ?>
78  <input type="text" name="home_cu_desc" size="40" maxlength="50" value="<?php echo $cu_info ?>">
79  </td>
80  </tr>
81  <tr>
82  <td class='dtl'>&nbsp;</td>
83  <td nowrap class='dtl'>
84  <input type="submit" name="Save" Value="Save">
85  <!-- <input type="button" name="Cancel" Value="Cancel" onClick="document.location='hcu_prod_list'"> -->
86  </td>
87  </tr>
88 
89 
90  <?php // If the error value is here then print it at the end
91  if (isset($form_err)) {
92  echo "<tr><td colspan=2 class='err'>$form_err</td></tr>";
93  echo "<hr>";
94  }
95  ?>
96  </table>
97  </td></tr></table>
98  </form>
99  </body>
100 </html>