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