Avatar of cfwd
cfwdFlag for United States of America

asked on 

Help with showing recordsets on my pages

I am trying to allow the user to enter data on a form, then they go to the next page and that data shows up.  I am using Dreamweaver and I know just pulling a recordset of the entry should work but it isn't.  Anyone have any suggestions why the recordset keeps coming up blank? I've tried to echo the POST as well but nothing works.


<?php require_once('Connections/harveys_connection.php'); ?>
<?php
//initialize the session
session_start();
 
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  session_unregister('MM_Username');
  session_unregister('MM_UserGroup');
	
  $logoutGoTo = "loginmed.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
 
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 
 
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}
 
$MM_restrictGoTo = "unauthorized.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
	  $theValue = ($theValue != "") ? "'" . date("Y-m-d",strtotime($theValue)) . "'" : "NULL";
      break;
	case "time":
	  $theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
      break;
    case "datetime":
	  $theValue = ($theValue != "") ? "'" . date("Y-m-d H:i:s",strtotime($theValue)) . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frm_pmdo_add")) {
  $insertSQL = sprintf("INSERT INTO harvey_patients (hdw_id, Medicare_Number, Patient_Last_Name, Patient_First_Name, Date_of_Birth, HICN_Number, Height, Weight, Group_2_Powerchair_K0823, Heavy_Duty_powerchair_K0824, Reclining_Back_E1226, Flat_Free_Tires_K0093, Adj_Detachable_Arms_E0973, Headrest_E0955, Batteries_E2365, batteries_heavy_duty_E0973, Seat_Belt_Safety_Belt_E0978, Positioning_Cushion_E2611, Back_Support_Cushion_E2611, Elevating_Leg_Rests_E0990, Oxygen_Tank_Holder_E2208, Code, Diagnosis_1, ICD9_Code_1, Diagnosis_2, ICD9_Code_2, Diagnosis_3, ICD9_Code_3, Diagnosis_4, ICD9_Code_4, Length_of_Need, Question_1_yn, Question_1_explain, Question_2_yn, Question_2_explain, Question_3_yn, Question_4_yn, Question_4upper_yn, Question_4lower_yn, Question_4_explain, Question_5_yn, Question_6_yn, Question_7_yn, More_Information, certify, completion_date, practitioners_name, UPIN, `Date`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Medicare_Number'], "text"),
                       GetSQLValueString($_POST['Medicare_Number'], "text"),
                       GetSQLValueString($_POST['Patient_Last_Name'], "text"),
                       GetSQLValueString($_POST['Patient_First_Name'], "text"),
                       GetSQLValueString($_POST['Date_of_Birth'], "text"),
                       GetSQLValueString($_POST['HICN_Number'], "text"),
                       GetSQLValueString($_POST['Height'], "text"),
                       GetSQLValueString($_POST['Weight'], "text"),
                       GetSQLValueString($_POST['Group_2_Powerchair_K0823'], "text"),
                       GetSQLValueString($_POST['Heavy_Duty_powerchair_K0824'], "text"),
                       GetSQLValueString($_POST['Reclining_Back_E1226'], "text"),
                       GetSQLValueString($_POST['Flat_Free_Tires_K0093'], "text"),
                       GetSQLValueString($_POST['Adj_Detachable_Arms_E0973'], "text"),
                       GetSQLValueString($_POST['Headrest_E0955'], "text"),
                       GetSQLValueString($_POST['Batteries_E2365'], "text"),
                       GetSQLValueString($_POST['batteries_heavy_duty_E0973'], "text"),
                       GetSQLValueString($_POST['Seat_Belt_Safety_Belt_E0978'], "text"),
                       GetSQLValueString($_POST['Positioning_Cushion_E2611'], "text"),
                       GetSQLValueString($_POST['Back_Support_Cushion_E2611'], "text"),
                       GetSQLValueString($_POST['Elevating_Leg_Rests_E0990'], "text"),
                       GetSQLValueString($_POST['Oxygen_Tank_Holder_E2208'], "text"),
                       GetSQLValueString($_POST['Code'], "text"),
                       GetSQLValueString($_POST['Diagnosis_1'], "text"),
                       GetSQLValueString($_POST['ICD9_Code_1'], "text"),
                       GetSQLValueString($_POST['Diagnosis_2'], "text"),
                       GetSQLValueString($_POST['ICD9_Code_2'], "text"),
                       GetSQLValueString($_POST['Diagnosis_3'], "text"),
                       GetSQLValueString($_POST['ICD9_Code_3'], "text"),
                       GetSQLValueString($_POST['Diagnosis_4'], "text"),
                       GetSQLValueString($_POST['ICD9_Code_4'], "text"),
                       GetSQLValueString($_POST['Length_of_Need'], "text"),
                       GetSQLValueString($_POST['Question_1_yn'], "text"),
                       GetSQLValueString($_POST['Question_1_explain'], "text"),
                       GetSQLValueString($_POST['Question_2_yn'], "text"),
                       GetSQLValueString($_POST['Question_2_explain'], "text"),
                       GetSQLValueString($_POST['Question_3_yn'], "text"),
                       GetSQLValueString($_POST['Question_4_yn'], "text"),
                       GetSQLValueString($_POST['Question_4upper_yn'], "text"),
                       GetSQLValueString($_POST['Question_4lower_yn'], "text"),
                       GetSQLValueString($_POST['Question_4_explain'], "text"),
                       GetSQLValueString($_POST['Question_5_yn'], "text"),
                       GetSQLValueString($_POST['Question_6_yn'], "text"),
                       GetSQLValueString($_POST['Question_7_yn'], "text"),
                       GetSQLValueString($_POST['More_Information'], "text"),
                       GetSQLValueString($_POST['certify'], "text"),
 
 
                       GetSQLValueString($_POST['completion_date'], "text"),
                       GetSQLValueString($_POST['practitioners_name'], "text"),
                       GetSQLValueString($_POST['UPIN'], "text"),
                       GetSQLValueString($_POST['Date'], "text"));
 
  mysql_select_db($database_harveys_connection, $harveys_connection);
  $Result1 = mysql_query($insertSQL, $harveys_connection) or die(mysql_error());
 
  $insertGoTo = "home_med.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
 
$colname_rs_pmdo = "1";
if (isset($_GET['Medicare_Number'])) {
  $colname_rs_pmdo = (get_magic_quotes_gpc()) ? $_GET['Medicare_Number'] : addslashes($_GET['Medicare_Number']);
}
mysql_select_db($database_harveys_connection, $harveys_connection);
$query_rs_pmdo = sprintf("SELECT * FROM harvey_patients WHERE Medicare_Number = '%s'", $colname_rs_pmdo);
$rs_pmdo = mysql_query($query_rs_pmdo, $harveys_connection) or die(mysql_error());
$row_rs_pmdo = mysql_fetch_assoc($rs_pmdo);
$totalRows_rs_pmdo = mysql_num_rows($rs_pmdo);
 
mysql_select_db($database_harveys_connection, $harveys_connection);
$query_rs_medical_professionals = "SELECT * FROM harvey_registration";
$rs_medical_professionals = mysql_query($query_rs_medical_professionals, $harveys_connection) or die(mysql_error());
$row_rs_medical_professionals = mysql_fetch_assoc($rs_medical_professionals);
$totalRows_rs_medical_professionals = mysql_num_rows($rs_medical_professionals);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Power Mobility Detailed Order; Face To Face Examination Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style4 {font-size: 14px; font-weight: bold; }
.style7 {font-size: 14px}
.style5 {font-weight: bold}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>

Open in new window

Adobe DreamweaverPHP

Avatar of undefined
Last Comment
Jason C. Levine
Avatar of cfwd
cfwd
Flag of United States of America image

ASKER

I have been able to make a recordset show up but it is not the one the user enters.  The recordset that shows up is the first one in the database.  HELP!
ASKER CERTIFIED SOLUTION
Avatar of Promethyl
Promethyl
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo