dynamic html

Reply

Join Date: Mar 2008
Posts: 2
Reputation: juvincy is an unknown quantity at this point 
Solved Threads: 0
juvincy juvincy is offline Offline
Newbie Poster

dynamic html

 
0
  #1
Mar 21st, 2008
Hello,
I have been trying to develope an online registration system but i can get the right syntax to use in the developement
here are the specifications

We have the following types of visits
• Admission
• Control/Entry/ Visit2/ visit3(routine1)/ visit4(routine2)/ annual
• Acute(unscheduled visit)
On register response page, we should have a drop down with the 3 options, the with one of the second option active. As in option 1 and 3 are static but option 2 is dynamic.
STEP 1
Patient searched prior to regisration and added to demographic table if not exist
STEP 2 opregistration and ipregisration
Aim to search through op and ipregister and select current isit based on the existing record
Control visit:
Search opregiter,ipregister
If patient does not exist in opregister then select control
Add patient details in samps table

Entry visit
Search opregister,ipregister,
if exists in opregister and patient last visit in opregister==Control then visit type==entry OR
if patient exists in ipregister and does not exist in opregister then visit==entry
update samps table set visit1==1 after regstration

Visit2
Search opregister, ipregister.if patient exists in opregister and (samps.visit1==1 and visit2 is null and visit3==null and visit4 is null)
(opregister.lastvisitdate-datetoday)datediff<365
(visittype for lastvisitdate in opregister is not acute and lastvisittype in opregister is not control)
Update visit2==1 after registration
Visit3
Patient exists in opregister
Last visit type is not acute and last visit type is not control
Last visit date is not for an acute visit
Date diff < 365
Samps.visit1==1, samps.visit2==1, samps.visit3==null,samps.visit4==null
Update visit3 in samps to 1

Visit 4
Patient exist in opregister
Last visit type is not acute and last visit type is not control
Last visit date is not for an acute visit
Date diff < 365
Samps.visit1==1, samps.visit2==1, samps.visit3==1,samps.visit4==null
Update visit1 to visit4 in samps to null

Annual
Patient exists in opregister
Last visit date is not for an acute visit
Date diff >365
Update samps.visit1==1 samps.visit2==null,samps.visit3==null, samps.visit4==null after registration

codes for registration pages are
registerresponce.php
/////////////////
  1. <?php
  2. session_start();
  3. ob_start();
  4. ?>
  5. <?php
  6. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  7. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  8. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  9. header("Cache-Control: post-check=0, pre-check=0", false);
  10. header("Pragma: no-cache"); // HTTP/1.0
  11. ?>
  12. <? //include common files?>
  13. <?php include ("ewconfig.php") ?>
  14. <?php include ("db.php") ?>
  15. <?php include ("advsecu.php") ?>
  16. <?php include ("connect.php") ?>
  17. <?php include ("defaults.php") ?>
  18. <?php include ("ewupload.php") ?>
  19. <?php
  20. //check if user is logged in
  21. if (!IsLoggedIn()) {
  22. ob_end_clean();
  23. header("Location: login.php");
  24. exit();
  25. }
  26. $id=$_GET['id'];
  27. //echo $id;
  28. $visittype=$_POST['visittype'];
  29. $demographic_id = @$_POST["demographic_id"];
  30. ?>
  31. <?php include ("header.php") ?>
  32.  
  33. <form name="fregisterresponce" action="opregisteradd.php">
  34.  
  35. <input type="hidden" name="id" id="id" value="<? echo $id; ?>">
  36. <table class="bordercolor" cellpadding="2" cellspacing="1">
  37. <tr>
  38. <?php
  39. $str_query = "Select
  40. opregister.datetod, opregister.scdno,
  41. opregister.visittype,samps.zpp,samps.serum,samps.visit1,samps.visit2,samps.visit3,samps.visit4,DATEDIFF(CURDATE(),opregister.datetod) as datediff,demographic.id as demographic
  42. From opregister
  43. inner join samps on opregister.demographic_id = samps.demographic_id
  44. inner join demographic on demographic.id= opregister.demographic_id
  45. Where opregister.demographic_id = '$id' and opregister.visittype!='AC' order by opregister.datetod asc";
  46.  
  47. $mysql_access = mysql_connect("localhost", "root","root");
  48.  
  49. mysql_select_db("scd_study", $mysql_access);
  50.  
  51. $result = mysql_query($str_query, $mysql_access);
  52.  
  53. if(mysql_num_rows($result)) {
  54. while($row = mysql_fetch_row($result))
  55. {
  56. $maxdate = $row[0];//prints all dates
  57. $scdno = $row[1];
  58. $visittype = $row[2];
  59. $zpp = $row[3];
  60. $serum = $row[4];
  61. $visit1 = $row[5];
  62. $visit2 = $row[6];
  63. $visit3 = $row[7];
  64. $visit4 = $row[8];
  65. $datediff = $row[9];
  66. $demographic=$row[10];
  67. }
  68. } else {
  69. echo("no rows");
  70.  
  71. }
  72. //print the maximum date
  73.  
  74.  
  75. print "Last Visit Date ".$maxdate;
  76. //print "VisitType ".$maxdate;
  77.  
  78. $today = date("Y-m-d");
  79. print "<br>";
  80. print "today ".$today;
  81. //$days = $today - $maxdate; // is there a date difference function in PHP?
  82.  
  83. print "<br>";
  84. print "Days diff ".$datediff;
  85. if(($datediff>365) || ($visit1='Null') || (is_null($visit1)))
  86. {
  87. //if ((($visit1='') || (is_null($visit1))) && (($visit2='') || (is_null($visit2))) && (($visit3='') || (is_null($visit3))) && (($visit4='') || (is_null($visit4)) ))
  88. //{
  89. $opt = "AN";
  90. // $sql="UPDATE samps SET visit1='1' where demographic_id='$id'";
  91. //$res = mysql_query($sql) or die(mysql_error());
  92. //}
  93. }
  94.  
  95.  
  96. elseif (($visit2=='Null') || (is_null($visit2)))
  97. {
  98. $opt = "V2";
  99. //$sql="UPDATE samps SET visit2='1' where demographic_id='$id'";
  100. //$res = mysql_query($sql) or die(mysql_error());
  101. }
  102. elseif (($visit3=='Null') || (is_null($visit3)))
  103. {
  104. $opt = "RO";
  105. //$sql="UPDATE samps SET visit3='1' where demographic_id='$id'";
  106. //$res = mysql_query($sql) or die(mysql_error());
  107. }
  108. elseif (($visit4=='Null') || (is_null($visit4)))
  109. {
  110. $opt="RO1";
  111. //$sql="UPDATE samps SET visit1='',visit2='',visit3='',visit4='' where demographic_id='$id'";
  112. //$res = mysql_query($sql) or die(mysql_error());
  113. }
  114. ?>
  115.  
  116.  
  117.  
  118. <td class="g">Select visit type</td>
  119. <td class="g"><select name="visittype">
  120. <option>Select</option>
  121. <option id="visittype">ADM</option>
  122. <option id="visittype">NE</option>
  123. <option id="visittype"><?php echo($opt);?></option>
  124.  
  125. <option id="visittype">AC</option>
  126. <option id="visittype">CO</option>
  127. </select></td>
  128. </tr>
  129. <tr><td><input type="submit" name="btnAction" id="btnAction" value="Continue">
  130. </td></tr>
  131. </table>
  132. <?php include ("footer.php") ?>
  133. </form>
/////////////////
opregisteradd.php
/////////////////
  1. <?php
  2. session_start();
  3. ob_start();
  4. ?>
  5. <?php
  6. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  7. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  8. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  9. header("Cache-Control: post-check=0, pre-check=0", false);
  10. header("Pragma: no-cache"); // HTTP/1.0
  11. ?><? //include common files?>
  12. <?php include ("ewconfig.php") ?>
  13. <?php include ("db.php") ?>
  14. <?php include ("opregisterinfo.php") ?>
  15. <?php include ("advsecu.php") ?>
  16. <?php include ("defaults.php") ?>
  17. <?php include ("ewupload.php") ?>
  18. <?php
  19. //check if user is logged in
  20. if (!IsLoggedIn()) {
  21. ob_end_clean();
  22. header("Location: login.php");
  23. exit();
  24. }
  25. ?>
  26. <?php
  27. //ShowUserLevelInfo();
  28. SetUpUserLevel();
  29. ?>
  30. <?php
  31. if (!CanAdd("opregister")) {
  32. $_SESSION[ewSessionMessage] = "You do not have permissions to view this page";
  33. ob_end_clean();
  34. header("Location: login.php");
  35. exit();
  36. }
  37. ?>
  38.  
  39. <?php //get user and date
  40. $username=@$_SESSION[ewSessionUserName];
  41. $s_today =date("Y-m-j");
  42. $today=ConvertDateToMysqlFormat2($GLOBALS["s_today"]);
  43.  
  44. // Initialize common variables
  45. $x_datetod = NULL;
  46. $ox_datetod = NULL;
  47. $z_datetod = NULL;
  48. $ar_x_datetod = NULL;
  49. $ari_x_datetod = NULL;
  50. $x_datetodList = NULL;
  51. $x_datetodChk = NULL;
  52. $cbo_x_datetod_js = NULL;
  53. $x_scdno = NULL;
  54. $ox_scdno = NULL;
  55. $z_scdno = NULL;
  56. $ar_x_scdno = NULL;
  57. $ari_x_scdno = NULL;
  58. $x_scdnoList = NULL;
  59. $x_scdnoChk = NULL;
  60. $cbo_x_scdno_js = NULL;
  61. $x_hospid = NULL;
  62. $ox_hospid = NULL;
  63. $z_hospid = NULL;
  64. $ar_x_hospid = NULL;
  65. $ari_x_hospid = NULL;
  66. $x_hospidList = NULL;
  67. $x_hospidChk = NULL;
  68. $cbo_x_hospid_js = NULL;
  69. $x_demographic_id = NULL;
  70. $ox_demographic_id = NULL;
  71. $z_demographic_id = NULL;
  72. $ar_x_demographic_id = NULL;
  73. $ari_x_demographic_id = NULL;
  74. $x_demographic_idList = NULL;
  75. $x_demographic_idChk = NULL;
  76. $cbo_x_demographic_id_js = NULL;
  77. $x_visittype = NULL;
  78. $ox_visittype = NULL;
  79. $z_visittype = NULL;
  80. $ar_x_visittype = NULL;
  81. $ari_x_visittype = NULL;
  82. $x_visittypeList = NULL;
  83. $x_visittypeChk = NULL;
  84. $cbo_x_visittype_js = NULL;
  85. $x_consent = NULL;
  86. $ox_consent = NULL;
  87. $z_consent = NULL;
  88. $ar_x_consent = NULL;
  89. $ari_x_consent = NULL;
  90. $x_consentList = NULL;
  91. $x_consentChk = NULL;
  92. $cbo_x_consent_js = NULL;
  93. $x_q = NULL;
  94. $ox_q = NULL;
  95. $z_q = NULL;
  96. $ar_x_q = NULL;
  97. $ari_x_q = NULL;
  98. $x_qList = NULL;
  99. $x_qChk = NULL;
  100. $cbo_x_q_js = NULL;
  101. $x_sample = NULL;
  102. $ox_sample = NULL;
  103. $z_sample = NULL;
  104. $ar_x_sample = NULL;
  105. $ari_x_sample = NULL;
  106. $x_sampleList = NULL;
  107. $x_sampleChk = NULL;
  108. $cbo_x_sample_js = NULL;
  109. $x_comments = NULL;
  110. $ox_comments = NULL;
  111. $z_comments = NULL;
  112. $ar_x_comments = NULL;
  113. $ari_x_comments = NULL;
  114. $x_commentsList = NULL;
  115. $x_commentsChk = NULL;
  116. $cbo_x_comments_js = NULL;
  117. $x_fbp = NULL;
  118. $ox_fbp = NULL;
  119. $z_fbp = NULL;
  120. $ar_x_fbp = NULL;
  121. $ari_x_fbp = NULL;
  122. $x_fbpList = NULL;
  123. $x_fbpChk = NULL;
  124. $cbo_x_fbp_js = NULL;
  125. $x_biochemistry = NULL;
  126. $ox_biochemistry = NULL;
  127. $z_biochemistry = NULL;
  128. $ar_x_biochemistry = NULL;
  129. $ari_x_biochemistry = NULL;
  130. $x_biochemistryList = NULL;
  131. $x_biochemistryChk = NULL;
  132. $cbo_x_biochemistry_js = NULL;
  133. $x_hbelectro = NULL;
  134. $ox_hbelectro = NULL;
  135. $z_hbelectro = NULL;
  136. $ar_x_hbelectro = NULL;
  137. $ari_x_hbelectro = NULL;
  138. $x_hbelectroList = NULL;
  139. $x_hbelectroChk = NULL;
  140. $cbo_x_hbelectro_js = NULL;
  141. $x_urine = NULL;
  142. $ox_urine = NULL;
  143. $z_urine = NULL;
  144. $ar_x_urine = NULL;
  145. $ari_x_urine = NULL;
  146. $x_urineList = NULL;
  147. $x_urineChk = NULL;
  148. $cbo_x_urine_js = NULL;
  149. $x_nextvisit = NULL;
  150. $ox_nextvisit = NULL;
  151. $z_nextvisit = NULL;
  152. $ar_x_nextvisit = NULL;
  153. $ari_x_nextvisit = NULL;
  154. $x_nextvisitList = NULL;
  155. $x_nextvisitChk = NULL;
  156. $cbo_x_nextvisit_js = NULL;
  157. $x_enteredby = NULL;
  158. $ox_enteredby = NULL;
  159. $z_enteredby = NULL;
  160. $ar_x_enteredby = NULL;
  161. $ari_x_enteredby = NULL;
  162. $x_enteredbyList = NULL;
  163. $x_enteredbyChk = NULL;
  164. $cbo_x_enteredby_js = NULL;
  165. $x_entry1 = NULL;
  166. $ox_entry1 = NULL;
  167. $x_datedis = NULL;
  168. $ox_outcome = NULL;
  169. $z_entry1 = NULL;
  170. $ar_x_entry1 = NULL;
  171. $ari_x_entry1 = NULL;
  172. $x_entry1List = NULL;
  173. $x_entry1Chk = NULL;
  174. $cbo_x_entry1_js = NULL;
  175. $x_entry2 = NULL;
  176. $ox_entry2 = NULL;
  177. $z_entry2 = NULL;
  178. $ar_x_entry2 = NULL;
  179. $ari_x_entry2 = NULL;
  180. $x_entry2List = NULL;
  181. $x_entry2Chk = NULL;
  182. $cbo_x_entry2_js = NULL;
  183. $x_labentry = NULL;
  184. $ox_labentry = NULL;
  185. $z_labentry = NULL;
  186. $ar_x_labentry = NULL;
  187. $ari_x_labentry = NULL;
  188. $x_labentryList = NULL;
  189. $x_labentryChk = NULL;
  190. $cbo_x_labentry_js = NULL;
  191. ?>
  192. <?php
  193. $demoid=$_GET['id'];
  194. $visittype=$_GET['visittype'];
  195.  
  196.  
  197. //echo $visittype;
  198. // Load key from QueryString
  199. $bCopy = true;
  200. $x_datetod = @$_GET["datetod"];
  201.  
  202. if (($x_datetod == "") || (is_null($x_datetod))) $bCopy = false;
  203. $x_scdno = @$_GET["scdno"];
  204. if (($x_scdno == "") || (is_null($x_scdno))) $bCopy = false;
  205.  
  206. // Get action
  207. $sAction = @$_POST["a_add"];
  208. if (($sAction == "") || ((is_null($sAction)))) {
  209. if ($bCopy) {
  210. $sAction = "C"; // Copy record
  211. } else {
  212. $sAction = "I"; // Display blank record
  213. }
  214. } else {
  215. // Get fields from form
  216. $x_datetod = @$_POST["x_datetod"];
  217. $a_datetod = @$_POST["x_datetod"];
  218. $visittype = @$_POST["visittype"];
  219. $x_ward = @$_POST["x_ward"];
  220. $x_scdno = @$_POST["x_scdno"];
  221. $x_ascdno = @$_POST["x_ascdno"];
  222. $x_hospid = @$_POST["x_hospid"];
  223. $x_demographic_id = @$_POST["x_demographic_id"];
  224. $x_visittype = @$_POST["x_visittype"];
  225. $x_consent = @$_POST["x_consent"];
  226. $x_q = @$_POST["x_q"];
  227. $x_sample = @$_POST["x_sample"];
  228. $x_comments = @$_POST["x_comments"];
  229. $x_fbp = @$_POST["x_fbp"];
  230. $x_biochemistry = @$_POST["x_biochemistry"];
  231. $x_hbelectro = @$_POST["x_hbelectro"];
  232. $x_urine = @$_POST["x_urine"];
  233. $x_nextvisit = @$_POST["x_nextvisit"];
  234. $x_enteredby = @$_POST["x_enteredby"];
  235. $x_entrydate = @$_POST["x_entrydate"];
  236. $x_entry1 = @$_POST["x_entry1"];
  237. $x_entry2 = @$_POST["x_entry2"];
  238. $x_labentry = @$_POST["x_labentry"];
  239. $x_datedis = @$_POST["x_datedis"];
  240. $x_outcome = @$_POST["x_outcome"];
  241. }
  242. //start connection to the database
  243. $conn = scd_db_connect(HOST, USER, PASS, DB, PORT);
  244.  
  245. $sqllab="SELECT * FROM test_table WHERE demographic_id=$demoid";
  246. $reslab=mysql_query($sqllab);
  247. $totallab= mysql_num_rows($reslab);
  248. if($totallab==0)
  249. {
  250. $lab=0;
  251. }
  252. else if($totallab>=1)
  253. {
  254. $lab=1;
  255. }
  256. switch ($sAction) {
  257. case "C": // Copy record
  258. if (!LoadData($conn)) { // Load record
  259. $_SESSION[ewSessionMessage] = "No records found";
  260. scd_db_close($conn);
  261. ob_end_clean();
  262. header("Location: opregisterlist.php");
  263. exit();
  264. }
  265. break;
  266. case "A": // Add
  267. if($visittype=="ADM")
  268. {
  269.  
  270. $a_datetod =ConvertDateToMysqlFormat2($x_datetod);
  271. $x_datedis =ConvertDateToMysqlFormat2($x_datedis);
  272. $sqlip="INSERT INTO `ipregister` (`id`,`dateadm`,`ascdno`,`scdno`,`hospid`,`ward`,`demographic_id`,`problem`,
  273. `outcome`,`datedis`,`diagnosis`,`malaria`,`culture`,`entry1`,`entry2`,`enteredby`,`entrydate`)
  274. VALUES('','$a_datetod','$x_ascdno','$x_scdno','$x_hospid','$x_ward','$x_demographic_id','$x_problem','$x_outcome','$x_datedis','$x_diagnosis',
  275. '$x_malaria','$x_culture','$x_entry1','$x_entry2','$x_enteredby','$today')";
  276. echo $sqlip;
  277. $_SESSION[ewSessionMessage] = "Add New Record Successful";
  278. $res=mysql_query($sqlip) or die(mysql_error());
  279. header("Location: demographiclist.php");
  280. }
  281. else
  282. {
  283. if (AddData($conn))
  284. { // Add new record
  285. $_SESSION[ewSessionMessage] = "Add New Record Successful";
  286. scd_db_close($conn);
  287. ob_end_clean();
  288. header("Location: opregisterlist.php");
  289. exit();
  290. }
  291. }
  292. break;
  293. }
  294. ?>
  295. <?php include ("header.php") ?>
  296.  
  297. </style>
  298. <link rel="stylesheet" type="text/css" href="css/epoch_styles.css"/>
  299. <style type="text/css">
  300. <!--
  301. .info { color: black; background-color: transparent; font-weight: normal; }
  302. .warn { color: rgb(120,0,0); background-color: transparent; font-weight: normal; }
  303. .error { color: red; background-color: transparent; font-weight: bold }
  304.  
  305. .formtab TD
  306. { padding: 0.2em; height: 2.5em; vertical-align: top; font-size: 90%; }
  307.  
  308. -->
  309. </style>
  310. <script type="text/javascript">
  311. <!--
  312. EW_LookupFn = "ewlookup.php"; // ewlookup file name
  313. EW_AddOptFn = "ewaddopt.php"; // ewaddopt.php file name
  314.  
  315. //-->
  316. </script>
  317. <script type="text/javascript" src="ewp.js"></script>
  318. <script type="text/javascript">
  319. <!--
  320. EW_dateSep = "-"; // set date separator
  321.  
  322. //-->
  323. </script>
  324. </script>
  325. <script language="JavaScript" src="js/gen_validatorv2.js" type="text/javascript"></script>
  326. <script type="text/javascript" src="css/epoch_classes.js"></script>
  327. <script type="text/javascript" src="js/formval.js"></script>
  328. <script type="text/javascript">
  329. /*You can also place this code in a separate file and link to it like epoch_classes.js*/
  330. var datetod,next,dischargedate;
  331. var xmlHttp;
  332. var disparea;;
  333. window.onload = function () {
  334. datetod = new Epoch('epoch_popup','popup',document.getElementById('x_datetod'));
  335. next = new Epoch('epoch_popup','popup',document.getElementById('x_nextvisit'));
  336. dischargedate = new Epoch('epoch_popup','popup',document.getElementById('x_datedis'));
  337. };
  338. </script>
  339.  
  340. <script type="text/javascript">
  341. <!--
  342. function EW_checkMyForm(EW_this) {
  343. if (EW_this.x_datetod && !EW_hasValue(EW_this.x_datetod, "TEXT" )) {
  344. if (!EW_onError(EW_this, EW_this.x_datetod, "TEXT", "Please enter required field - datetod"))
  345. return false;
  346. }
  347. if (EW_this.x_labentry && !EW_hasValue(EW_this.x_labentry, "TEXT" )) {
  348. if (!EW_onError(EW_this, EW_this.x_labentry, "TEXT", "Please enter required field - labentry"))
  349. return false;
  350. }
  351. if (EW_this.x_scdno && !EW_hasValue(EW_this.x_scdno, "TEXT" )) {
  352. if (!EW_onError(EW_this, EW_this.x_scdno, "TEXT", "Please enter required field - Admno"))
  353. return false;
  354. }
  355.  
  356. return true;
  357. }
  358. function checkvalues(form)
  359. {
  360. /*if(document.forms.fopregisteradd.x_ascdno.value=="")
  361. {
  362.  alert('Please enter required field admission number');
  363.  return false;*/
  364. }
  365.  
  366. }
  367. //-->
  368. </script>
  369. <script type="text/javascript">
  370. <!--
  371. var EW_DHTMLEditors = [];
  372.  
  373. //-->
  374. </script>
  375. <p><span class="kemri_scd">Add to TABLE:Register<br>
  376. <br><a href="opregisterlist.php">Back to List</a></span></p>
  377.  
  378. <form name="fopregisteradd" id="fopregisteradd" action="opregisteradd.php" method="post" onSubmit="return EW_checkMyForm(this);">
  379. <p>
  380.  
  381. <input type="hidden" name="a_add" value="A">
  382. <input type="hidden" name="visittype" value="<? echo $visittype;?>">
  383. <input type="hidden" name="qsql" id="qsql" value="<? echo $sql; ?>">
  384. <?php
  385. if (@$_SESSION[ewSessionMessage] <> "") {
  386. ?>
  387. <p><span class="ewmsg"><?php echo $_SESSION[ewSessionMessage] ?></span></p>
  388. <?php
  389. $_SESSION[ewSessionMessage] = ""; // Clear message
  390. }
  391. $sql="select * from demographic where id=$demoid";
  392. $res=mysql_query($sql);
  393. $row=mysql_fetch_array($res);
  394. $scdno=$row['scdno'];
  395. switch($visittype)
  396. {
  397. case "ADM":
  398. $sql="select * from inpatient where Demographic_id=$demoid";
  399. $res=mysql_query($sql);
  400. $row=mysql_fetch_array($res);
  401. $ascdno=$row['ascdno'];
  402. break;
  403. case "FU":
  404. $sql="select * from followup where demographic_id=$demoid order by id desc";
  405. $res=mysql_query($sql);
  406. $row=mysql_fetch_array($res);
  407. $datetod=$row['datetod'];
  408. break;
  409. case "AN":
  410. $sql="select * from followup where demographic_id=$demoid order by id desc";
  411. $res=mysql_query($sql);
  412. $row=mysql_fetch_array($res);
  413. $datetod=$row['datetod'];
  414. break;
  415. case "AC":
  416. $sql="select * from followup where demographic_id=$demoid order by id desc";
  417. $res=mysql_query($sql);
  418. $row=mysql_fetch_array($res);
  419. $datetod=$row['datetod'];
  420. break;
  421. case "RO":
  422. $sql="select * from followup where demographic_id=$demoid order by id desc";
  423. $res=mysql_query($sql);
  424. $row=mysql_fetch_array($res);
  425. $datetod=$row['datetod'];
  426. break;
  427. case "CO":
  428. $sql="select * from control where demographic_id='$demoid'";
  429. $res=mysql_query($sql);
  430. $row=mysql_fetch_array($res);
  431. $cscdno=$row['cscdno'];
  432. $x_datetod=$row['datetod'];
  433. break;
  434. case "NE":
  435. $scdno="";
  436. break;
  437.  
  438. }
  439. ?>
  440. <table class="bordercolor2" cellpadding="2" cellspacing="1">
  441. <tr>
  442. <td colspan="4" class="oben">Screening</td>
  443. </tr>
  444. <tr>
  445. <td class="g">Name</td>
  446. <td class="g"><? $sql="SELECT name from demographic where id='$demoid'";
  447. $res=mysql_query($sql);
  448. $row=mysql_fetch_array($res);
  449. $name=$row['name'];
  450. echo $name;?></td>
  451. <td class="g">Control Number </td>
  452. <td class="g"><input type="text" name="x_cscdno" id="x_cscdno" size="10" maxlength="5" value="<?php echo htmlspecialchars(@$cscdno) ?>"></td>
  453. </tr>
  454. <tr>
  455. <td class="g"><span>SCD Number <span class='ewmsg'>&nbsp;*</span></span></td>
  456. <td class="g"><span id="cb_x_scdno">
  457. <input type="text" name="x_scdno" id="x_scdno" size="10" maxlength="5" value="<?php echo htmlspecialchars(@$scdno) ?>">
  458. </span></td>
  459. <td class="g"><span id="cb_x_demographic_id">
  460. <input type="hidden" name="x_demographic_id" id="x_demographic_id" size="30" value="<?php echo htmlspecialchars(@$demoid) ?>">
  461. <span>Today's Date*</span></td>
  462. <td class="g"><span id="cb_x_datetod">
  463. <input type="text" name="x_datetod" id="x_datetod" value="<?php echo FormatDateTime2(@$datetod,7); ?>">
  464. </span></td>
  465. </tr>
  466. <tr>
  467. <?php
  468.  
  469. $str_query = "Select
  470. opregister.datetod, opregister.scdno,
  471. opregister.visittype,samps.zpp,samps.serum,samps.visit1,samps.visit2,samps.visit3,samps.visit4,DATEDIFF(CURDATE(),opregister.datetod) as datediff
  472. From opregister inner join samps on opregister.demographic_id = samps.demographic_id
  473. Where opregister.demographic_id = '$demoid' and opregister.datetod !=CURDATE() and (opregister.visittype='FU' or opregister.visittype='RO' or opregister.visittype='AN' or opregister.visittype='V2') order by opregister.datetod asc";
  474.  
  475. $mysql_access = mysql_connect("localhost", "root","root");
  476.  
  477. mysql_select_db("scd_study", $mysql_access);
  478.  
  479. $result = mysql_query($str_query, $mysql_access);
  480.  
  481. if(mysql_num_rows($result)) {
  482. while($row = mysql_fetch_row($result))
  483. {
  484. $maxdate = $row[0];//prints all dates
  485. $scdno = $row[1];
  486. $visittype = $row[2];
  487. $zpp = $row[3];
  488. $serum = $row[4];
  489. $visit1 = $row[5];
  490. $visit2 = $row[6];
  491. $visit3 = $row[7];
  492. $visit4 = $row[8];
  493. $datediff = $row[9];
  494.  
  495. }
  496. } else {
  497. echo("no rows");
  498.  
  499. }
  500. //print the maximum date
  501. print "Last Visit Date ".$maxdate;
  502. //print "VisitType ".$maxdate;
  503.  
  504. $today = date("Y-m-d");
  505. print "<br>";
  506. print "today ".$today;
  507. //$days = $today - $maxdate; // is there a date difference function in PHP?
  508.  
  509. print "<br>";
  510. print "Days diff ".$datediff;
  511.  
  512. if(($datediff>365) || ($visit1='Null') || (is_null($visit1)))
  513. {
  514. //if ((($visit1='') || (is_null($visit1))) && (($visit2='') || (is_null($visit2))) && (($visit3='') || (is_null($visit3))) && (($visit4='') || (is_null($visit4)) ))
  515. //{
  516. $opt = "AN";
  517. $sql="UPDATE samps SET visit1='1' where demographic_id='$demoid'";
  518. //$res = mysql_query($sql) or die(mysql_error());
  519. //}
  520. }
  521.  
  522.  
  523. elseif (($visit2=='') || (is_null($visit2)))
  524. {
  525. $opt = "V2";
  526. $sql="UPDATE samps SET visit2='1' where demographic_id='$demoid'";
  527. //$res = mysql_query($sql) or die(mysql_error());
  528. }
  529. elseif (($visit3=='Null') || (is_null($visit3)))
  530. {
  531. $opt = "RO";
  532. $sql="UPDATE samps SET visit3='1' where demographic_id='$demoid'";
  533. //$res = mysql_query($sql) or die(mysql_error());
  534. }
  535.  
  536. elseif (($visit4=='Null') || (is_null($visit4)))
  537. {
  538. $opt="RO1";
  539. $sql="UPDATE samps SET visit1='Null',visit2='Null',visit3='Null',visit4='Null' where demographic_id='$demoid'";
  540. //$res = mysql_query($sql) or die(mysql_error());
  541. }
  542. ?>
  543.  
  544.  
  545.  
  546. <td class="g"><span>Visittype</span></td>
  547. <td class="g"><span id="cb_x_visittype">
  548. <select name="x_visittype" id="x_visittype">
  549. <? echo $visittype;?>
  550. <option>Select</option>
  551. <option id="x_visittype">ADM</option>
  552. <option id="x_visittype">NE</option>
  553. <option id="x_visittype"><?php echo($opt)?></option>
  554.  
  555. <option id="x_visittype">AC</option>
  556. <option id="x_visittype">CO</option>
  557. </select></td>
  558. <td class="g"><span><span class='ewmsg'><span id="">
  559. Admission Number</span></span></span></td>
  560. <td class="g"><span id="cb_x_ascdno">
  561. </span><input type="text" name="x_ascdno" id="x_ascdno" value="<?php echo htmlspecialchars(@$ascdno) ?>"></td>
  562. </tr>
  563. <tr>
  564. <td class="g"><span>Informed Consent</span></td>
  565. <td class="g"><span id="cb_x_consent"> <?php echo RenderControl(1, 0, 5, 1); ?>
  566. <input type="radio" name="x_consent"<?php if (@$x_consent == "1") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("1"); ?>">
  567. <?php echo "<span class=txt>Yes</span>"; ?> <?php echo RenderControl(1, 0, 5, 2); ?> <?php echo RenderControl(1, 1, 5, 1); ?>
  568. <input type="radio" name="x_consent"<?php if (@$x_consent == "0") { ?> checked<?php } ?> value="<?php echo htmlspecialchars("0"); ?>">
  569. <?php echo "<span class=txt>No</span>"; ?> <?php echo RenderControl(1, 1, 5, 2); ?> </span></td>
  570. <td class="g"><span>Hospital Id </span></td>
  571. <td class="g"><span id="cb_x_hospid">
  572. <input type="text" name="x_hospid" id="x_hospid" size="30" maxlength="10" value="<?php echo htmlspecialchars(@$x_hospid) ?>">
  573. </span></td>
  574. </tr>
  575. <tr>
  576. <td colspan="4" class="oben">Laboratory Investigation </td>
  577. </tr>
  578. <tr>
  579. <td class="g">Questionnaire</td>
  580. <td class="g"><span id="cb_x_q">
  581. <span id="cb_x_q"><?php echo RenderControl(1, 0, 5, 1); ?></span>
  582. <input type="radio" name="x_q" value="Y"<?php if ($x_q == "Y") { ?> checked<?php } ?>>
  583. <span id="cb_x_q"><?php echo "<span class=txt>Yes</span>"; ?></span><span id="cb_x_q"><?php echo RenderControl(1, 0, 5, 2); ?></span><span id="cb_x_q"><?php echo RenderControl(1, 1, 5, 1); ?></span>
  584. <input type="radio" name="x_q" value="N"<?php if ($x_q == "N") { ?> checked<?php } ?>>
  585. <span id="cb_x_q"><?php echo "<span class=txt>No</span>"; ?></span> <span id="cb_x_q"><?php echo RenderControl(1, 1, 5, 2); ?></span> </span></td>
  586. <td class="g"><span>Sample Taken </span></td>
  587. <td class="g"><span id="cb_x_sample">
  588. <span id="cb_x_sample"><span id="cb_x_sample"><?php echo RenderControl(1, 0, 5, 1); ?></span></span>
  589. <input type="radio" name="x_sample" value="Y"<?php if ($x_sample == "Y") { ?> checked<?php } ?>>
  590. <span id="cb_x_sample"><span id="cb_x_sample"><?php echo "<span class=txt>Yes</span>"; ?></span></span><span id="cb_x_sample"><span id="cb_x_sample"><?php echo RenderControl(1, 0, 5, 2); ?></span></span> <span id="cb_x_sample"><span id="cb_x_sample"><?php echo RenderControl(1, 1, 5, 1); ?></span></span>
  591. <input type="radio" name="x_sample" value="N"<?php if ($x_sample == "N") { ?> checked<?php } ?>>
  592. <span id="cb_x_sample"><span id="cb_x_sample"><?php echo "<span class=txt>No</span>"; ?></span></span> <span id="cb_x_sample"><span id="cb_x_sample"><?php echo RenderControl(1, 1, 5, 2); ?></span></span> </span></td>
  593. </tr>
  594. <tr>
  595. <td class="g">FBP</td>
  596. <td class="g"><span id="cb_x_fbp"> <span id="cb_x_fbp"><span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo RenderControl(1, 0, 5, 1); ?></span></span></span>
  597. <input type="radio" name="x_fbp" value="Y"<?php if ($x_fbp == "Y") { ?> checked<?php } ?>>
  598. <span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo "<span class=txt>Yes</span>"; ?></span></span><span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo RenderControl(1, 0, 5, 2); ?></span></span><span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo RenderControl(1, 1, 5, 1); ?></span></span>
  599. <input type="radio" name="x_fbp" value="N"<?php if ($x_fbp == "N") { ?> checked<?php } ?>>
  600. <span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo "<span class=txt>No</span>"; ?></span></span> <span id="cb_x_fbp"><span id="cb_x_fbp"><?php echo RenderControl(1, 1, 5, 2); ?></span></span> </span></td>
  601. <td class="g"><span>Biochemistry</span></td>
  602. <td class="g"><span id="cb_x_biochemistry"> <span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo RenderControl(1, 0, 5, 1); ?></span></span></span>
  603. <input type="radio" name="x_biochemistry" value="Y"<?php if ($x_biochemistry == "Y") { ?> checked<?php } ?>>
  604. <span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo "<span class=txt>Yes</span>"; ?></span></span> <span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo RenderControl(1, 0, 5, 2); ?></span></span><span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo RenderControl(1, 1, 5, 1); ?></span></span>
  605. <input type="radio" name="x_biochemistry" value="N"<?php if ($x_biochemistry == "N") { ?> checked<?php } ?>>
  606. <span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo "<span class=txt>No</span>"; ?></span></span> <span id="cb_x_biochemistry"><span id="cb_x_biochemistry"><?php echo RenderControl(1, 1, 5, 2); ?></span></span></span></td>
  607. </tr>
  608. <tr>
  609. <td class="g"><span>hbelectro</span></td>
  610. <td class="g"><span id="cb_x_hbelectro"> <span id="cb_x_sample"><span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo RenderControl(1, 0, 5, 1); ?></span></span></span>
  611. <input type="radio" name="x_hbelectro" value="Y"<?php if ($x_hbelectro == "Y") { ?> checked<?php } ?>>
  612. <span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo "<span class=txt>Yes</span>"; ?></span></span> <span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo RenderControl(1, 0, 5, 2); ?></span></span><span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo RenderControl(1, 1, 5, 1); ?></span></span>
  613. <input type="radio" name="x_hbelectro" value="N"<?php if ($x_hbelectro == "N") { ?> checked<?php } ?>>
  614. <span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo "<span class=txt>No</span>"; ?></span></span> <span id="cb_x_hbelectro"><span id="cb_x_hbelectro"><?php echo RenderControl(1, 1, 5, 2); ?></span></span></span></td>
  615. <td class="g"><span>Urine</span></td>
  616. <td class="g"><span id="cb_x_urine"> <span id="cb_x_urine"><span id="cb_x_urine"><span id="cb_x_urine"><?php echo RenderControl(1, 0, 5, 1); ?></span></span></span>
  617. <input type="radio" name="x_urine" value="Y"<?php if ($x_urine == "Y") { ?> checked<?php } ?>>
  618. <span id="cb_x_urine"><span id="cb_x_urine"><?php echo "<span class=txt>Yes</span>"; ?></span></span> <span id="cb_x_urine"><span id="cb_x_urine"><?php echo RenderControl(1, 0, 5, 2); ?></span></span> <span id="cb_x_urine"><span id="cb_x_urine"><?php echo RenderControl(1, 1, 5, 1); ?></span></span>
  619. <input type="radio" name="x_urine" value="N"<?php if ($x_urine == "N") { ?> checked<?php } ?>>
  620. <span id="cb_x_urine"><span id="cb_x_urine"><?php echo "<span class=txt>No</span>"; ?></span></span> <span id="cb_x_urine"><span id="cb_x_urine"><?php echo RenderControl(1, 1, 5, 2); ?></span></span> </span></td>
  621. </tr>
  622. <tr>
  623. <td class="g"><span>Comments</span></td>
  624. <td class="g"><textarea name="x_comments" id="x_comments" ><? echo $x_comments; ?></textarea></td>
  625. <td class="g"><span>Nextvisit</span></td>
  626. <td class="g"><span id="cb_x_nextvisit">
  627. <input type="text" name="x_nextvisit" id="x_nextvisit" value="<?php echo FormatDateTime(@$x_nextvisit,5); ?>">
  628. <input type="hidden" name="x_entry1" id="x_entry1" value="<?php echo htmlspecialchars(@$entry); ?>">
  629. <input type="hidden" name="x_labentry" id="x_labentry" value="<?php echo htmlspecialchars(@$lab); ?>">
  630. <input type="hidden" name="x_enteredby" id="x_enteredby" value="<?php echo htmlspecialchars(@$_SESSION[ewSessionUserName]); ?>">
  631. <input type="hidden" name="x_entrydate" id="x_entrydate" value="<?php echo FormatDateTime2(@$today,7); ?>">
  632. </span></td>
  633. </tr>
  634. <tr>
  635. <td colspan="4" class="oben">Overall Assessment </td>
  636. </tr>
  637. <tr>
  638. <td class="g">Ward</td>
  639. <td class="g"><input type="text" name="x_ward" id="x_ward"></td>
  640. <td class="g">Date of Discharge </td>
  641. <td class="g"><input type="text" name="x_datedis" id="x_datedis"></td>
  642. </tr>
  643. <tr>
  644. <td class="g">Outcome</td>
  645. <td class="g"><select name="x_outcome">
  646. <option id="x_outcome">Select</option>
  647. <option id="x_outcome">DEA</option>
  648. <option id="x_outcome">DIS</option>
  649. </select></td>
  650. <td class="g">&nbsp;</td>
  651. <td class="g">&nbsp;</td>
  652. </tr>
  653. <tr>
  654. <td>
  655. <input type="submit" name="btnAction" id="btnAction" value="ADD" onClick="return checkvalues(this);">
  656. </td></tr>
  657. </table>
  658. <p>
  659. </form>
  660. <?php include ("footer.php") ?>
  661. <?php
  662. scd_db_close($conn);
  663. ?>
  664. <?php
  665.  
  666. //-------------------------------------------------------------------------------
  667. // Function LoadData
  668. // - Variables setup: field variables
  669.  
  670. function LoadData($conn)
  671. {
  672. global $x_datetod;
  673. global $x_scdno;
  674. $sFilter = ewSqlKeyWhere;
  675. $x_datetod = (get_magic_quotes_gpc()) ? stripslashes($x_datetod) : $x_datetod;
  676. $sFilter = str_replace("@datetod", AdjustSql($x_datetod), $sFilter); // Replace key value
  677. $x_scdno = (get_magic_quotes_gpc()) ? stripslashes($x_scdno) : $x_scdno;
  678. $sFilter = str_replace("@scdno", AdjustSql($x_scdno), $sFilter); // Replace key value
  679. $sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
  680. $rs = scd_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . scd_error($conn) . '<br>SQL: ' . $sSql);
  681. if (scd_num_rows($rs) == 0) {
  682. $bLoadData = false;
  683. } else {
  684. $bLoadData = true;
  685. $row = scd_fetch_array($rs);
  686.  
  687. // Get the field contents
  688. $GLOBALS["x_datetod"] = $row["datetod"];
  689. $GLOBALS["x_scdno"] = $row["scdno"];
  690. $GLOBALS["x_hospid"] = $row["hospid"];
  691. $GLOBALS["x_demographic_id"] = $row["demographic_id"];
  692. $GLOBALS["x_visittype"] = $row["visittype"];
  693. $GLOBALS["x_consent"] = $row["consent"];
  694. $GLOBALS["x_q"] = $row["q"];
  695. $GLOBALS["x_sample"] = $row["sample"];
  696. $GLOBALS["x_comments"] = $row["comments"];
  697. $GLOBALS["x_fbp"] = $row["fbp"];
  698. $GLOBALS["x_biochemistry"] = $row["biochemistry"];
  699. $GLOBALS["x_hbelectro"] = $row["hbelectro"];
  700. $GLOBALS["x_urine"] = $row["urine"];
  701. $GLOBALS["x_nextvisit"] = $row["nextvisit"];
  702. $GLOBALS["x_enteredby"] = $row["enteredby"];
  703. $GLOBALS["x_entrydate"] = $row["entrydate"];
  704. $GLOBALS["x_entry1"] = $row["entry1"];
  705. $GLOBALS["x_entry2"] = $row["entry2"];
  706. $GLOBALS["x_labentry"] = $row["labentry"];
  707. }
  708. scd_free_result($rs);
  709. return $bLoadData;
  710. }
  711. ?>
  712. <?php
  713.  
  714. //-------------------------------------------------------------------------------
  715. // Function AddData
  716. // - Add Data
  717. // - Variables used: field variables
  718.  
  719. function AddData($conn)
  720. {
  721. global $x_datetod;
  722. global $x_scdno;
  723. $sFilter = ewSqlKeyWhere;
  724.  
  725. // Check for duplicate key
  726. $bCheckKey = true;
  727. if ((@$x_datetod == "") || (is_null(@$x_datetod))) {
  728. $bCheckKey = false;
  729. } else {
  730. $sFilter = str_replace("@datetod", AdjustSql($x_datetod), $sFilter); // Replace key value
  731. }
  732. if ((@$x_scdno == "") || (is_null(@$x_scdno))) {
  733. $bCheckKey = false;
  734. } else {
  735. $sFilter = str_replace("@scdno", AdjustSql($x_scdno), $sFilter); // Replace key value
  736. }
  737. if ($bCheckKey) {
  738. $sSqlChk = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
  739. $rsChk = scd_query($sSqlChk, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . scd_error($conn) . '<br>SQL: ' . $sSqlChk);
  740. if (scd_num_rows($rsChk) > 0) {
  741. $_SESSION[ewSessionMessage] = "Duplicate value for primary key";
  742. scd_free_result($rsChk);
  743. return false;
  744. }
  745. scd_free_result($rsChk);
  746. }
  747.  
  748. // Field datetod
  749. $theValue = ($GLOBALS["x_datetod"] != "") ? " '" . ConvertDateToMysqlFormat2($GLOBALS["x_datetod"]) . "'" : "Null";
  750. $fieldList["`datetod`"] = $theValue;
  751. // Field scdno
  752. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_scdno"]) : $GLOBALS["x_scdno"];
  753. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  754. $fieldList["`scdno`"] = $theValue;
  755.  
  756. // Field hospid
  757. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_hospid"]) : $GLOBALS["x_hospid"];
  758. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  759. $fieldList["`hospid`"] = $theValue;
  760.  
  761. // Field demographic_id
  762. $theValue = ($GLOBALS["x_demographic_id"] != "") ? intval($GLOBALS["x_demographic_id"]) : "NULL";
  763. $fieldList["`demographic_id`"] = $theValue;
  764.  
  765. // Field visittype
  766. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_visittype"]) : $GLOBALS["x_visittype"];
  767. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  768. $fieldList["`visittype`"] = $theValue;
  769.  
  770. // Field consent
  771. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_consent"]) : $GLOBALS["x_consent"];
  772. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  773. $fieldList["`consent`"] = $theValue;
  774.  
  775. // Field q
  776. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_q"]) : $GLOBALS["x_q"];
  777. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  778. $fieldList["`q`"] = $theValue;
  779.  
  780. // Field sample
  781. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_sample"]) : $GLOBALS["x_sample"];
  782. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  783. $fieldList["`sample`"] = $theValue;
  784.  
  785. // Field comments
  786. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_comments"]) : $GLOBALS["x_comments"];
  787. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  788. $fieldList["`comments`"] = $theValue;
  789.  
  790. // Field fbp
  791. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_fbp"]) : $GLOBALS["x_fbp"];
  792. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  793. $fieldList["`fbp`"] = $theValue;
  794.  
  795. // Field biochemistry
  796. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_biochemistry"]) : $GLOBALS["x_biochemistry"];
  797. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  798. $fieldList["`biochemistry`"] = $theValue;
  799.  
  800. // Field hbelectro
  801. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_hbelectro"]) : $GLOBALS["x_hbelectro"];
  802. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  803. $fieldList["`hbelectro`"] = $theValue;
  804.  
  805. // Field urine
  806. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_urine"]) : $GLOBALS["x_urine"];
  807. $theValue = (strtoupper($theValue) != "Y") ? " 'N'" : " 'Y'";
  808. $fieldList["`urine`"] = $theValue;
  809.  
  810. // Field nextvisit
  811. $theValue = ($GLOBALS["x_nextvisit"] != "") ? " '" . ConvertDateToMysqlFormat2($GLOBALS["x_nextvisit"]) . "'" : "Null";
  812. $fieldList["`nextvisit`"] = $theValue;
  813.  
  814. // Field enteredby
  815. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_enteredby"]) : $GLOBALS["x_enteredby"];
  816. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  817. $fieldList["`enteredby`"] = $theValue;
  818.  
  819. // Field entrydate
  820. $theValue = ($GLOBALS["x_entrydate"] != "") ? " '" . ConvertDateToMysqlFormat2($GLOBALS["x_entrydate"]) . "'" : "Null";
  821. $fieldList["`entrydate`"] = $theValue;
  822.  
  823. // Field entry1
  824. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_entry1"]) : $GLOBALS["x_entry1"];
  825. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  826. $fieldList["`entry1`"] = $theValue;
  827.  
  828. // Field entry2
  829. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_entry2"]) : $GLOBALS["x_entry2"];
  830. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  831. $fieldList["`entry2`"] = $theValue;
  832.  
  833. // Field labentry
  834. $theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_labentry"]) : $GLOBALS["x_labentry"];
  835. $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL";
  836. $fieldList["`labentry`"] = $theValue;
  837.  
  838. // Inserting event
  839. if (Recordset_Inserting($fieldList)) {
  840.  
  841. // Insert
  842. $sSql = "INSERT INTO `opregister` (";
  843. $sSql .= implode(",", array_keys($fieldList));
  844. $sSql .= ") VALUES (";
  845. $sSql .= implode(",", array_values($fieldList));
  846. $sSql .= ")";
  847. scd_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . scd_error($conn) . '<br>SQL: ' . $sSql);
  848. $result = (scd_affected_rows($conn) > 0);
  849. // echo $sSql;
  850. // Inserted event
  851. if ($result) Recordset_Inserted($fieldList);
  852. } else {
  853. $result = false;
  854. }
  855. return $result;
  856. }
  857.  
  858. // Inserting event
  859. function Recordset_Inserting(&$newrs)
  860. {
  861.  
  862. // Enter your customized codes here
  863. return true;
  864. }
  865.  
  866. // Inserted event
  867. function Recordset_Inserted($newrs)
  868. {
  869. $table = "opregister";
  870. }
  871.  
  872. ?>
  873.  


/////////////////
Kindly assist
Thanks
Last edited by peter_budo; Mar 23rd, 2008 at 5:53 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 66
Reputation: silviuks is an unknown quantity at this point 
Solved Threads: 11
silviuks silviuks is offline Offline
Junior Poster in Training

Re: dynamic html

 
0
  #2
Mar 21st, 2008
do you really think that somebody will read the whole code posted?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: dynamic html

 
0
  #3
Mar 22nd, 2008
What Silviuks said.
No one is going to read through the whole code, let alone that entire thing of specs you have.

Your best bet is to tell us which part of the code is failing, even better yet what is happening when you view the site?

I mean, are you getting an error of some sort? is it mysql related or php related?

If you really want to find out where you are getting lost, echo out all of your variables and see what is not getting passed.
Sage
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC