Jump to content

rsammy

Members
  • Posts

    212
  • Joined

  • Last visited

    Never

Everything posted by rsammy

  1. thanks. but, itd be great if u can be a lil more specific. im a novice in php!  i really appreciate ur quick response tho!
  2. guyz, i have a screen with some fields like first name, middle initial, last name, address, city, state, zip, phone number, date of birth, ssn. user populates these fields with some values. i need to store these values in the database. (insert into a table, say patient table in MySQL database) when user clicks on Add button on screen. On clicking Add, a new screen appears displaying all the above fields as Text only fields(cannot be edited) with a text saying the following patient has been added! while entering the values in the fields, if user enters  the name as john smith, it should be displayed on the screen as John Smith and entered into the db as such. i know there is a function called onBlur and i have a fucntion written for it too. but, it doesnt work! ??? I know its a simple app. but, i am kinda new to php and am still findin it difficult to go about this one. i need help big time. any help here would appreciated greatly. thanks in advance.
  3. hi, i need to resize some buttons and their positions too. how do i do this in php/html? heres my sample code... <tr>                 <td colspan="3" height="51"> <div align="center">                     <?PHP if ((isset($pat_ID)) && ($result))                     {                     print"<font class=goodTXT>The above information was updated successfully!</font>";                     }   else     {     print "<font class=errTxt>(mysql_error())</font>";     } ?>                     <!--<form method="post" action="PatientInsdetails.php" name="form2"> -->                     <form method="post" action="Patientdetails.php" name="form2">                       <table width="563" border="0" cellspacing="0" cellpadding="0">                         <tr>                           <td width="282" height="35"> <input type="hidden" name="pat_ID2" value="<? print ("$pat_ID"); ?>">                             <input type="hidden" name="pat_first_name" value="<? print ("$PatientFirstName"); ?>">                             <input type="hidden" name="pat_last_name" value="<? print ("$PatientLastName"); ?>">     <input name="client_id" type="hidden" id="client_id5" value="<? print("$client_id"); ?>">                           </td>                           <td width="281" height="35"> <input class="sbttn" type="submit" name="Submit2" value="Get Insurance Details">                           </td>                         </tr>                       </table>               </tr> there are more than 2 buttons on some pages. not sure how to change their sizes! any help will be greatly appreciated! thanx in advance
  4. thanx guys
  5. not sure if this is the place to ask this question. im sorry if its the wrong place ??? ive tried lookin up for this with no success? is it used to retrieve values from previous screen? thanx
  6. Hi, I am trying to populate some fields on screen with values from db. i wrote the query and tested it out in MySQL and it works fine. it returns the necessary records. only, when i use the same query in my code, just the label names print on screen and no values for them. here is the code... I am not sure where exactly the problem is, so am attaching the entire code for this page here. <?PHP //File for database information //require_once ("phpInclude/config.php"); require_once ("../config.php"); //File to verify authenticated user include ("phpInclude/cookie.php"); if (isset($USER_NAME)) { list($user_fname, $user_lname) = explode (' ', $USER_NAME); $pat_ID=$_POST["pat_ID"]; if ($USER_NAME == ' Office Manager') { $query= "SELECT grp_name FROM group_details"; } else { $query= "SELECT grp_name FROM group_details, user_mgr WHERE user_mgr.user_fname='$user_fname' AND user_mgr.user_lname='$user_lname' AND user_mgr.user_grp_id=group_details.grp_id"; } $result=mysql_query($query); $row = mysql_fetch_array($result); $group_name = $row["grp_name"]; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>INSTICOMM</title> <link rel='stylesheet' type='text/css' href='css/styleSheet.css'> <SCRIPT language="JavaScript" src="js/tree.js"></script> <SCRIPT language="JavaScript" src="js/validateSSN.js"></SCRIPT> <SCRIPT language="JavaScript"> function trim(inputString) {   // Removes leading and trailing spaces from the passed string. Also   // removes consecutive spaces and replaces it with one space.   var retValue = inputString;   var ch = retValue.substring(0, 1);   while (ch == " ") { // Check for spaces at the beginning of the string   retValue = retValue.substring(1, retValue.length);   ch = retValue.substring(0, 1); }     ch = retValue.substring(retValue.length-1, retValue.length);     while (ch == " ") { // Check for spaces at the end of the string       retValue = retValue.substring(0, retValue.length-1);       ch = retValue.substring(retValue.length-1, retValue.length); }   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string   retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings } return retValue; // Return the trimmed string back to the user } // Ends the "trim" function function validate() { var err_msg = new Array(); var i=0; var j=0; var bigstring = "Please correct the following errors:\n"; var loginID = ""; var pass = ""; var count = 0; var aMatch = false; var aBlank = false; PatientFirstName = document.changeStatus.PatientFirstName.value; PatientLastName = document.changeStatus.PatientLastName.value; AdmitStatus = document.changeStatus.AdmitStatus.value; AdmitLocation = document.changeStatus.AdmitLocation.value; AdmitRoomNo = document.changeStatus.AdmitRoomNo.value; PatientCity = document.changeStatus.PatientCity.value; PatientState = document.changeStatus.PatientState.value; PatientZip = document.changeStatus.PatientZip.value; PatientHomePhone = document.changeStatus.PatientHomePhone.value; PatientDOB = document.changeStatus.PatientDOB.value; PatientSSN = document.changeStatus.PatientSSN.value; PatientSex = document.changeStatus.PatientSex.value; PatientEmergencyContactName= document.changeStatus.PatientEmergencyContactName.value; PatientEmergencyPhone= document.changeStatus.PatientEmergencyPhone.value; PatientEmployerPhone = document.changeStatus.PatientEmployerPhone.value; InsuranceProvider = document.changeStatus.InsuranceProvider.value; InsuranceID = document.changeStatus.InsuranceID.value; PatientRelationship = document.changeStatus.PatientRelationship.value; ClientName = document.changeStatus.ClientName.value; } </Script> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function changeCase(frmObj) { var index; var tmpStr; var tmpChar; var preString; var postString; var strlen; //tmpStr = frmObj.value.toLowerCase(); tmpStr = frmObj.value; strLen = tmpStr.length; if (strLen > 0) { for (index = 0; index < strLen; index++) { if (index == 0) { tmpChar = tmpStr.substring(0,1).toUpperCase(); postString = tmpStr.substring(1,strLen); tmpStr = tmpChar + postString; } else { tmpChar = tmpStr.substring(index, index+1); if (tmpChar == " " && index < (strLen-1)) { tmpChar = tmpStr.substring(index+1, index+2).toUpperCase(); preString = tmpStr.substring(0, index+1); postString = tmpStr.substring(index+2,strLen); tmpStr = preString + tmpChar + postString; } }   } } frmObj.value = tmpStr; } //  End --> </SCRIPT> <SCRIPT language="JavaScript"> <?PHP //Navigation File require_once ("../nav.php"); ?> </SCRIPT> <? $query=" SELECT pat_dgraphics.pat_first_name, pat_dgraphics.pat_mid_init, pat_dgraphics.pat_last_name, pat_dgraphics.pat_home_ph, Date_Format(pat_dgraphics.pat_dob, '%m/%d/%Y') as pat_dob, pat_dgraphics.pat_ssn, pat_dgraphics.pat_ID, pat_dgraphics.pat_phy_id, Date_Format(pat_dgraphics.pat_reg_date, '%m/%d/%Y') as enter_date, pat_dgraphics.pat_client_id, pat_ins_det.ins_pro, pat_ins_det.ins_grp_id, Date_Format(admit_stat.admit_visit_date, '%m/%d/%Y') as activate_date, admit_stat.admit_reason, admit_stat.admit_visit_loc, admit_stat.admit_room_no FROM pat_dgraphics, pat_ins_det, admit_stat where pat_ID='$pat_ID' "; print ("$pat_ID"); $result=mysql_db_query("$database[dbname]", $query); $r=mysql_fetch_array($result); $pat_first_name=$r["pat_first_name"]; $pat_mid_init=$r["pat_mid_init"]; $pat_last_name=$r["pat_last_name"]; $pat_home_ph=$r["pat_home_ph"]; $pat_dob=$r["pat_dob"]; $pat_ssn=$r["pat_ssn"]; $pat_client_id=$r["pat_client_id"]; $pat_phy_id = $r["pat_phy_id"]; $ins_pro = $r["ins_pro"]; $admit_reason = $r["admit_reason"]; $admit_status = $r["admit_status"]; $admit_visit_loc = $r["admit_visit_loc"]; $admit_room_no = $r["admit_room_no"]; $activate_date = $r["$activate_date"]; $enter_date = $r["$enter_date"]; $query ="SELECT * FROM pat_ins_det where ins_pat_id='$pat_ID' "; $result = mysql_query($query); $row= mysql_fetch_array($result); $ins_pro=$row["ins_pro"]; $ins_ref=$row["ins_ref"]; $ins_id=$row["ins_id"]; $ins_grp_id=$row["ins_grp_id"]; $clientquery="SELECT client_name FROM clients WHERE client_id = '$pat_client_id'"; $resultclient= mysql_query($clientquery); $row=mysql_fetch_array($resultclient); $client_name=$row["client_name"]; ?> </head> <BODY onload="window.scroll(0,yoffset)"> <table width="900" border="0" cellspacing="0" cellpadding="0">   <tr>     <td colspan="4" bgcolor="#FFFFFF">       <div align="left"><font color="#FFFFFF"></font></div>       <div align="right"><font color="#FFFFFF"><img src="images/title_barom.jpg" width="900" height="49"></font></div></td>   </tr>   <tr>     <td align="left" valign="top" width="276"> <table width="276" border="0" cellspacing="0" cellpadding="0">         <tr>           <td align="left" valign="top"><div align="center"><img src="../images/clear.gif" height="15" width="1"><font color="#006699"><img src="images/clear.gif" height="15" width="1"><b><?PHP print($group_name); ?><br>               User: </b><?PHP print($USER_NAME); ?> </font></div></td>         </tr>         <tr>           <td align="left" valign="top"> <SCRIPT language="JavaScript">   tree.loadState()   tree.display() </SCRIPT> </td>         </tr> </table>       </td>         </a><br>         <br>       </div>       <table width="614" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#006699">           <tr>             <td bgcolor="#006699" width="475" height="19"> <div align="left"><b><font color="#FFFFFF">Existing                 Patient: Change Patient Information/Status</font></b> </div></td>         </tr>         <tr>           <td> <table width="608" border="0" cellspacing="0" cellpadding="0">               <tr>                 <td colspan="3"><img src="../images/clear.gif" width="1" height="15"></td>               </tr>               <tr>                 <td width="15">&nbsp;</td>                 <!--<td width="578" rowspan="3" align="left" valign="top"> <form name="EditPatInfo" method="post" action="UpdatedPatInfo.php" onSubmit="return validate()">-->                 <td width="578" rowspan="3" align="left" valign="top"> <form name="changeStatus" method="post" action="updatedStatus.php" onSubmit="return validate()">                 <p align="center"><br><b>EXISTING PATIENT INFORMATION</b> <br></p>                     <table width="563" border="0" cellspacing="0" cellpadding="0">                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">                             <input type="hidden" name="pat_ID" value="<? print ("$pat_ID"); ?>">                             </font></div></td>                         <td colspan="2">&nbsp;</td>                       </tr>                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">&nbsp;&nbsp;                             </font></div></td>                         <td colspan="2">&nbsp;</td>                       </tr>                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">First                             Name: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><font class="plnTxtBl" type="text" name="PatientFirstName"><? print ("$pat_first_name"); ?></font>                         </td>                       </tr>                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">Middle                             Initial: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><font class="plnTxtBl"><? print ("$pat_mid_init"); ?></font>                         </td>                       </tr>                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">Last                             Name: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><font class="plnTxtBl"><? print ("$pat_last_name"); ?></font>                         </td>                       </tr>                       <tr>     <td width="283"> <div align="right"><font class="inputLbl">Date   of Birth as mm/dd/yyyy: &nbsp;&nbsp; </font></div></td>     <td colspan="2"><font class="plnTxtBl"><? print ("$pat_dob"); ?></font> <script language=javascript> function validateBDay() { var BirthdayDay = document.EditPatInfo.PatientDOB.value; var bDate = BirthdayDay.split("/"); var bMonth = bDate[0]; var bDay = bDate[1]; var bYear = bDate[2]; var BDate = new Date(bYear, (bMonth - 1), bDay); var Today = new Date(); TodayDay = Today.getDate(); TodayMon = Today.getMonth()+1; TodayYear = Today.getYear(); if (TodayYear < 2000) TodayYear += 1900; //var sysdate = new Date(); if (BDate > Today) alert("Birthday cannot be greater than today's date"); } </script></td>   </tr>   <tr>   <td width="283"> <div align="right"><font class="inputLbl">ASN/   SSN as a 9-digit number: &nbsp;&nbsp; </font></div></td>   <td colspan="2"><font class="plnTxtBl"><? print ("$pat_ssn"); ?></font>   </td>   <!--<td width="108"><font class="errTxt"> <? if (!is_numeric($pat_ssn)){ print ("Please assign a valid 9-digit numeric ASN/ SSN for this patient."); } ?> </font></td> -->                       </tr>                       <tr> <td width="283"> <div align="right"><font class="inputLbl">Home Phone as 000-000-0000: &nbsp;&nbsp; </font></div></td> <td colspan="2"><font class="plnTxtBl"><? print ("$pat_home_ph"); ?></font> </td>                       </tr>                       <tr> <td><div align="right"><font class="inputLbl">Insurance Provider: &nbsp;&nbsp;</font></div></td> <td colspan="2"><font class="plnTxtBl"><? print ("$ins_pro"); ?></font> </td>   </tr> </table>   <!--<tr>                         <td width="283"> <div align="right"><font class="inputLbl">Employer                             Name: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"> <input class="txtboxLarge" type="text" name="PatientEmployer" value="<? print("$pat_emp"); ?>"  onBlur="javascript:changeCase(document.EditPatInfo.PatientEmployer);">                         </td>                       </tr>                       <tr>                         <td width="283"> <div align="right"><font class="inputLbl">Occupation:                             &nbsp;&nbsp; </font></div></td>                         <td colspan="2"> <input class="txtboxLarge" type="text" name="PatientOccupation" value="<? print("$pat_occ"); ?>"  onBlur="javascript:changeCase(document.EditPatInfo.PatientOccupation);">                         </td>                       </tr>                       <tr>                         <td><div align="right"><font class="inputLbl">Employer                             Phone as 000-000-0000: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><input class="txtboxLarge" type="text" name="PatientEmployerPhone" value="<? print("$pat_emp_ph"); ?>" ></td>                       </tr> -->                       <p align="center"><b>STATUS INFORMATION</b> <br></p> <table width="562" border="0" cellspacing="0" cellpadding="0">                       <tr>   <td> <div align="right"><font class="inputLbl">Reason:&nbsp;&nbsp;</font></div></td>   <td colspan="2"> <input name="reason" type="text" class="txtboxLarge" value="<? if(isset($admit_reason)){print ("$admit_reason"); } ?>" > <span class="errTxt"> </span></td>                       </tr>                       <tr> <td width="283"> <div align="right"><font class="inputLbl">Preferred Provider:&nbsp;&nbsp;</font></div></td> <td colspan="2"> <?PHP //$query="select phy_id, phy_fname, phy_lname from phy_det order by phy_lname, phy_fname"; $query="select phy_id, phy_fname, phy_lname from phy_det where phy_disabled = 'Enable' order by phy_lname, phy_fname"; $result= mysql_query ($query); if ($result) { print ("<select name='physician'>"); if ($row = mysql_fetch_array($result))   {   do     {     print("<option value=\"");     print $row["phy_id"]; if($pat_phy_id == $row["phy_id"]) { print("\" selected>"); } else {   print("\">"); }     //print $row["phy_fname"]; print (" "); print $row["phy_lname"];     print $row["phy_lname"]; print (", "); print $row["phy_fname"];       print("</option>");   }   while($row = mysql_fetch_array($result));   }   }             print ("</select>"); ?>     </td>   </tr>       <tr>     <td><div align="right"><font class="inputLbl">Registered         Client: &nbsp;</font> </div></td>     <td colspan="2"><? $queryclient="SELECT client_name, client_id FROM clients";     $resultclient= mysql_query($queryclient);   if ($resultclient)   //if (mysql_num_rows($resultclient) != 0)     { //print ("<select name='client_id'>"); print ("<select name='ClientName'>"); //echo "$row"; if ($row = mysql_fetch_array($resultclient))   {     do   { print("<option value=\""); echo $row["client_name"]; if ($row["client_name"]== $client_name) { print("\" selected>"); } else { print("\">");   } print $row["client_name"]; print("</option>");     //}   }     while($row = mysql_fetch_array($resultclient));   }   }             print ("</select>");   //}   ?></td>                       </tr>                       <tr>                         <td><div align="right"><font class="inputLbl">Insurance                             Ref #: &nbsp;&nbsp;</font></div></td>                         <td colspan="2"><input name="ins_ref" type="text" class="txtboxLarge" id="ins_ref"  onBlur="javascript:changeCase(document.EditPatInfo.InsuranceProvider);" value="<? print("$ins_ref"); ?>"></td>                       </tr>-->                       <tr> <td width="282"> <div align="right"><font class="inputLbl">Status: &nbsp;&nbsp; </font></div></td> <td colspan="2"><input class="txtboxLarge" type="text" name="AdmitStatus" value="<? print ("$admit_status"); ?>"> </td>                       </tr>                       <tr>                         <td width="282"> <div align="right"><font class="inputLbl">Location: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><input class="txtboxLarge" type="text" name="AdmitLocation" value="<? print ("$admit_visit_loc"); ?>">                         </td>                       </tr>                       <tr>                         <td width="282"> <div align="right"><font class="inputLbl">Room#: &nbsp;&nbsp; </font></div></td>                         <td colspan="2"><input class="txtboxLarge" type="text" name="AdmitRoomNo" value="<? print ("$admit_room_no "); ?>">                         </td>                       </tr>   <tr> <td width="278"> <div align="right"><font class="inputLbl">Enter Date:&nbsp; &nbsp; </font></div></td> <td colspan="2"><font class="plnTxtBl"><? print ("$enter_date"); ?></font></td>   </tr>   <tr> <td width="278"> <div align="right"><font class="inputLbl">Activate Date:&nbsp; &nbsp; </font></div></td> <td colspan="2"><font class="plnTxtBl"><? print ("$activate_date"); ?></font></td>                     </tr>                       <tr>                         <td width="282"> <div align="right"></div></td>                         <td width="280">&nbsp;</td>                       </tr>                       <tr>                         <td width="282"> <div align="right"></div></td>                         <td width="280"> <input class="sbttn" type="submit" name="Submit" value="Update">                         </td>                       </tr>                       <tr>                         <td width="282"> <div align="right"></div></td>                         <td width="280">&nbsp;</td>                       </tr>                     </table>                   </form>                   <p align="center">&nbsp;</p>                   <p align="center">&nbsp;</p></td>                 <td width="15">&nbsp;</td>               </tr>               <tr>                 <td width="15">&nbsp;</td>                 <td width="15">&nbsp;</td>               </tr>               <tr>                 <td width="15" height="478"><img src="../images/clear.gif" width="15" height="8"></td>                 <td width="15" height="478"><img src="../images/clear.gif" width="15" height="1"></td>               </tr>               <tr>                 <td colspan="3"><img src="../images/clear.gif" width="1" height="15"></td>               </tr>             </table></td>         </tr>       </table>       <p>&nbsp;</p></td>   </tr>   <tr>     <td align="left" valign="top" width="276"> </td>     <td colspan="3" width="624">&nbsp;</td>   </tr> </table> </body> </html> <?PHP mysql_close(); ?> **************************** can someone help me out with this one please? thanx in advance
  7. Sorry for not replyin earlier. I was on vacation and just got back. I figured it out during my vacation and got it to work. Thanks a lot guys, for all your help.
  8. [!--quoteo(post=385723:date=Jun 19 2006, 02:17 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Jun 19 2006, 02:17 PM) [snapback]385723[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try changing this: [code]if ($resultclient){[/code] To this: [code]if (mysql_num_rows($resultclient) != 0){[/code] Orio. [/quote] Thanks for your response, Orio. Tried this one too, no change in the result!
  9. [!--quoteo(post=385145:date=Jun 17 2006, 07:18 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 17 2006, 07:18 PM) [snapback]385145[/snapback][/div][div class=\'quotemain\'][!--quotec--] Dunno about selected="true", but I do know selected="selected" works on all the browsers I've tried it with. Regardless, you've posted the solution to the OP's questions so let's sit back and wait to see if it's solved for him/her. [/quote] thanx for your help, Andy and Fyorl! I was able to make some progress. I used "selected" in the loop and it now displays testclient2 as the highlighted value for this client. however, i tried repeating the same sequence of steps but changed the Registred client field to test client for th esame user instead of test client2 and clicked update. I once again pulled up info for this patient and to try another update operation. this time, however, the registered cilent field shows test client2 as the default even though the actual value should have been test client. is there something wrong that im doing? heres the piece of code that i changed.... <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;</font> </div></td> <td colspan="2"><? $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient) { //print ("<select name='client_id'>"); print ("<select name='ClientName'>"); //echo "$row"; if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); //print $row["client_id"]; print $row["client_name"]; print("\" selected>"); //print ("Prov. "); print $row["client_name"]; //print $row["client_id"]; //echo "$client_name"; print("</option>"); } while($row = mysql_fetch_array($resultclient)); } } print ("</select>"); //} ?></td> </tr>
  10. [!--quoteo(post=384756:date=Jun 16 2006, 05:29 PM:name=lazyuser)--][div class=\'quotetop\']QUOTE(lazyuser @ Jun 16 2006, 05:29 PM) [snapback]384756[/snapback][/div][div class=\'quotemain\'][!--quotec--] thanx for the response! yes, i need to know both. i need to know how to generate a drop down box with values in a db table. i need to then select a value from this list and store it. i should then be able to update this value (at a later stage) with another value from the same list and store it! hope that makes it clear this time thanx [/quote] [b]ILL TRY TO BE EVEN CLEARER THIS TIME.[/b].. i have a screen called Patient Info. Here, I enter all the details of the patient and there is a field called Registered Client in this screen. Here, I select a value from a drop down list(test client and test client2 are the values here - for now). I choose test client2 and submit it. This is then stored. Now, I want to search for Existing Patients. I do that and find this patient and check out his details. Since I hade already selected test client2 as the value for Registered Client, that is what I should be seeing there. And I do. When I click on the Update button to be able make some changes there, the drop down shows the default value as test client (the first in the list) and not test client2. Thats where the problem is. I need to see test client2 as the default value in the drop down. This feature was working earlier when I did not use drop downs on the Update screen.We used to display this field(in the update screen) as a text box. The value displayed in the text box reflected the value selected earlier.But, you could end up typing anything in this field llike dddd or abcd, etc., for the Registered Client. We wanted to prevent this by providing a drop down with some pre determined list for the users to choose from rather than type in their own values there! I am able to display the drop down with the values from the database. But, I need this drop down to display the correct value from the list (that is test client2) instead of the original default value(test client). I hope this explanation is much clear now. to better explain my point, I am providing the previous code (which had the changed value displayed in a textbox) here: <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;&nbsp;</font></div></td> <td > <? if (isset($client_name)){print("<input name='ClientName' type='text' class='txtboxLarge' id='ClientName' value= '$client_name' >");print("&nbsp;<font class='redTxt'>*</font></td>");} else { $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient){ print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); print $row["client_name"]; print("\">"); print $row["client_name"]; print("</option>"); } while($row = mysql_fetch_array($resultclient)); } } print ("</select>"); print("<font class='redTxt'>*</font></td> <td ><font class='errTxt'>Please register this patient with a client.</font></td>" ); } ?> </tr> ***************************************** The new code that I put in (to use the drop down list) is: <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;</font> </div></td> <td colspan="2"><? $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient) { //print ("<select name='client_id'>"); print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); //print $row["client_id"]; print $row["client_name"]; print("\">"); //print ("Prov. "); //print $row["client_name"]; //print $row["client_id"]; print("</option>"); } while($row = mysql_fetch_array($resultclient)) } } print ("</select>"); ?></td> </tr> ******************************** What changes do I need to make to make the drop down list point to the chosen value of test client2 instead of the default value of test client ??? I would really appreciate any help regarding this query. Thanks in advance [!--quoteo(post=385083:date=Jun 17 2006, 04:31 PM:name=lazyuser)--][div class=\'quotetop\']QUOTE(lazyuser @ Jun 17 2006, 04:31 PM) [snapback]385083[/snapback][/div][div class=\'quotemain\'][!--quotec--] ILL TRY TO BE EVEN CLEARER THIS TIME... i have a screen called Patient Info. Here, I enter all the details of the patient and there is a field called Registered Client in this screen. Here, I select a value from a drop down list(test client and test client2 are the values here - for now). I choose test client2 and submit it. This is then stored. Now, I want to search for Existing Patients. I do that and find this patient and check out his details. Since I hade already selected test client2 as the value for Registered Client, that is what I should be seeing there. And I do. When I click on the Update button to be able make some changes there, the drop down shows the default value as test client (the first in the list) and not test client2. Thats where the problem is. I need to see test client2 as the default value in the drop down. This feature was working earlier when I did not use drop downs on the Update screen.We used to display this field(in the update screen) as a text box. The value displayed in the text box reflected the value selected earlier.But, you could end up typing anything in this field llike dddd or abcd, etc., for the Registered Client. We wanted to prevent this by providing a drop down with some pre determined list for the users to choose from rather than type in their own values there! I am able to display the drop down with the values from the database. But, I need this drop down to display the correct value from the list (that is test client2) instead of the original default value(test client). I hope this explanation is much clear now. to better explain my point, I am providing the previous code (which had the changed value displayed in a textbox) here: <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;&nbsp;</font></div></td> <td > <? if (isset($client_name)){print("<input name='ClientName' type='text' class='txtboxLarge' id='ClientName' value= '$client_name' >");print("&nbsp;<font class='redTxt'>*</font></td>");} else { $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient){ print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); print $row["client_name"]; print("\">"); print $row["client_name"]; print("</option>"); } while($row = mysql_fetch_array($resultclient)); } } print ("</select>"); print("<font class='redTxt'>*</font></td> <td ><font class='errTxt'>Please register this patient with a client.</font></td>" ); } ?> </tr> ***************************************** The new code that I put in (to use the drop down list) is: <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;</font> </div></td> <td colspan="2"><? $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient) { //print ("<select name='client_id'>"); print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); //print $row["client_id"]; print $row["client_name"]; print("\">"); //print ("Prov. "); //print $row["client_name"]; //print $row["client_id"]; print("</option>"); } while($row = mysql_fetch_array($resultclient)) } } print ("</select>"); ?></td> </tr> ******************************** What changes do I need to make to make the drop down list point to the chosen value of test client2 instead of the default value of test client ??? I would really appreciate any help regarding this query. Thanks in advance [/quote]
  11. [!--quoteo(post=384753:date=Jun 16 2006, 05:10 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Jun 16 2006, 05:10 PM) [snapback]384753[/snapback][/div][div class=\'quotemain\'][!--quotec--] OK, I'm confused. Are you asking how to generate a dropdown list from data in a database table, or are you asking how to generate a dropdown list from data in a database table AND have the option that matches something chosen previously appear as the 'selected' option in the new dropdown? [/quote] thanx for the response! yes, i need to know both. i need to know how to generate a drop down box with values in a db table. i need to then select a value from this list and store it. i should then be able to update this value (at a later stage) with another value from the same list and store it! hope that makes it clear this time thanx
  12. Hi, I am working on an application that involves using a drop down to select an item from the list on a page. Once selected, this same filed can be updated in another screen but it still should load with the previously selected value highlighed in the drop down box. User can then select another option and update it. to make it more clear. .. there is a field called Registered Client. The field was populated as Test Client earlier. Later on when we select this record and want to update the values here, the Registered Client field displays Test Client on window load. The user should have the option to change it to say, Test Client 2. The way the system now works is the user can just type the value on the field and say Update to update the record. But, what if he enters some junk, say, dddddd for this field? the system still accepts it. To prevent this from happening, I thot I could use a drop down list box from which I can select pre-specified values. How do I do this? to better explain this point, i am pasting the existing code here... <tr> <td><div align="right"><font class="inputLbl">Registered Client: &nbsp;&nbsp;</font></div></td> <td > <? if (isset($client_name)){print("<input name='ClientName' type='text' class='txtboxLarge' id='ClientName' value= '$client_name' >");print("&nbsp;<font class='redTxt'>*</font></td>");} else { $queryclient="SELECT client_name, client_id FROM clients"; $resultclient= mysql_query($queryclient); if ($resultclient){ print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); print $row["client_name"]; print("\">"); //print ("Prov. "); print $row["client_name"]; print("</option>"); } while($row = mysql_fetch_array($resultclient)); } } print ("</select>"); print("<font class='redTxt'>*</font></td> <td ><font class='errTxt'>Please register this patient with a client.</font></td>" ); } //} ?> </tr>
×
×
  • 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.