Jump to content

shackwm60

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by shackwm60

  1. Ok, well i am using a new function with the date_create function and it works well and is small. function age($birthday) { $ageYears = date_create($birthday)->diff(date_create('today'))->y; return $ageYears; } Thanks for all your assistance.
  2. I changed it to the dashes instead of slashes and still the same result.. I will keep plugging. thanks.
  3. I DO echo $patientsbirthday to the page in the first post. I dont see any error. And as i indicated, sometime the calculation works, sometimes not.
  4. Yea there were many different varieties of Age functions i was looking at but i settled on that one. If i cant get it to work right, i will try the others. Thanks.
  5. it returns Warning: date_parse() expects parameter 1 to be string, but $(monthnum) IS a string??
  6. so i found a function for age some time ago and seems like it works SOME of the time, but ive recently run across some errors; function age($patientsbirthday){ list($day,$month,$year) = explode("/",$patientsbirthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($day_diff < 0 && $month_diff==0){$year_diff--;} if ($day_diff < 0 && $month_diff < 0){$year_diff--;} return $year_diff; } The persons birthday is input as day, month (DEcember), and year (all varchar) i convert the month to a number using $monthnum = $row['birthmonth']; $monthnum = date_parse($monthnum); and then pass this to the function $patientsbirthday = $row['birthday']. "/" . $monthnum['month'] ."/".$row['birthyear']; heres a couple examples i get returned: echo $patientsbirthday; echo " (" . age($patientsbirthday) . ")"; 10/4/2004 (10) correct 12/12/1991 (23) correct 1/12/2000 (15) incorrect 23/9/1969 (45) correct 3/9/1988 (27) incorrect Anybody see something obvious i am doing wrong here?
  7. oh duh.. i just figured it out.. im so stupid. i just moved this new code over from a test server but forgot to move the new db structure over.. so those fields dont exist yet sleep time...
  8. oh sorry.. well its a select * so everything is there. The result echos everything i just get a NOTICE undefined index.
  9. Please explain the philosophy here.. if this is ok and generates no errors or Notices $result = mysqli_query($connection, $query); if (!$result) { die("Database Query Failed: " . mysql_error()); } else { } while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>Address</td>"; echo "<td>"; echo $row['streetaddress']; echo "</td></tr>"; } Why does this code which is seemingly the same - aside from the logic test - generate an Undefined Index Notice? if (!empty($row['child1name'])) { echo "<tr>"; echo "<td colspan=\"2\">"; echo $row['child1name'] . " (" . $row['child1age'] . ")"; } and is the correct answer to decalre all of these variables in advance? thanks.
  10. Thanks Cronix.. that did it. I was way off. Unfortunately mac-gyver the db has existed for a while and theeres numerous instances like this one. i am just making changes for someone. thanks for the input.
  11. This will be an easy one for you guys... One of the fields in a MySQL database is a varchar() that was populated using a checkbox method and can contain more than one response. in this case i have blue, yellow, green and want to check if the field contains blue before echoing the statement to the screen. How would i use strpos in this case? ive tried a few thigns and get syntax error. The below of course works if the field ONLY contains blue. if (($row['colorsyoulike']) =='blue') { echo "<tr>"; echo "<td>Blue is an available Color!</td>"; } thanks.
  12. you ARE seeing the submmit button??! Thats odd.. i am trying all three of those browsers too.. i will check the css pffft.. geez.. i just turned of the css in my browser and there it is! well i must have an errant submit style tag somewhere.. thanks!
  13. Ok.. i was trying to avoid putting all this code in but here it is.. <?php // DEFINE THE QUERY $clientid = $_GET['clientid']; $query = "SELECT * "; $query .= "FROM newclienttable "; $query .= "WHERE _rowid_ = " . "'" . $clientid . "'"; //echo "<strong>This is the Query: " . $query . "</strong><br>"; // PERFORM DB QUERY $result = mysqli_query($connection, $query); if (!$result) { die("Database Query Failed: " . mysql_error()); } else { // echo "<br><strong>Query Successful. The ClientID is: " . $clientid . "</strong><br>"; } // Use Returned Data while ($row = mysqli_fetch_array($result)) { // --------------- Accordion Display Start -----------------------------> echo "<div>"; // Div to store Client Information echo "<input id=\"ac-1\" name=\"accordion-1\" type=\"checkbox\" checked />"; echo "<label for=\"ac-1\">Client Information - ( "; echo $row['assignedcounselor'] . " )"; echo "</label>"; echo "<article class=\"ac-auto\">"; echo "<table class=\"h3 bordered zebra-striped\">"; echo "<tr>"; echo "<td>Patient Name (" . $row['childadult']; echo ")</td>"; echo "<td>"; echo $row['firstname'] ." ". $row['lastname']; echo "</td></tr>"; // Variables to Calcualate Age $monthnum = $row['birthmonth']; $monthnum = date_parse($monthnum); $patientsbirthday = $row['birthday']. "/" . $monthnum['month'] ."/".$row['birthyear']; echo "<tr>"; echo "<td>Birthday</td>"; echo "<td>"; echo $row['birthmonth'] . "-" . $row['birthday'] . "-". $row['birthyear']; echo " (" . age($patientsbirthday) . ")"; echo "</td></tr>"; // Age function and Display Complete echo "<tr>"; echo "<td>Patient EMail </td>"; echo "<td>"; echo $row['emailpatient']; echo "</td></tr>"; echo "<tr>"; echo "<td>Patient SSN</td>"; echo "<td>"; echo $row['ssnpatient']; echo "</td></tr>"; echo "<tr>"; echo "<td>Address</td>"; echo "<td>"; echo $row['streetaddress']; echo "</td></tr>"; echo "<tr>"; echo "<td>Address</td>"; echo "<td>"; echo $row['streetaddress2']; echo "</td></tr>"; echo "<tr>"; echo "<td>City</td>"; echo "<td>"; if (($row['cityselect']) == "Other") { echo $row['othercity']; } else { echo $row['cityselect']; } echo "</td></tr>"; echo "<tr>"; echo "<td>State</td>"; echo "<td>"; if (($row['stateselect']) == "Other") { echo $row['otherstate']; } else { echo $row['stateselect']; } echo "</td></tr>"; echo "<tr>"; echo "<td>Zip Code</td>"; echo "<td>"; echo $row['zipcode']; echo "</td></tr>"; echo "</table>"; echo "</article>"; echo "</div>"; if (($row['childadult']) =='Child') { echo "<div>"; // Div to store Child Info echo "<input id=\"ac-2\" name=\"accordion-1\" type=\"checkbox\" />"; echo "<label for=\"ac-2\">CHILD CLIENT INFO</label>"; echo "<article class=\"ac-auto\">"; echo "<table class=\"h3 bordered zebra-striped\">"; echo "<tr>"; echo "<td>Presenting</td>"; echo "<td>"; echo $row['patientproblem']; echo "</td></tr>"; echo "<tr>"; echo "<td>Service Requested</td>"; echo "<td>"; echo $row['servicestype']; echo "</td></tr>"; echo "<tr>"; echo "<td>Client Expectations</td>"; echo "<td>"; echo $row['patientexpectations']; echo "</td></tr>"; echo "<tr>"; echo "<td>Client Physician</td>"; echo "<td>"; echo $row['patientphysician']; echo "</td></tr>"; echo "<tr>"; echo "<td>Client Meds</td>"; echo "<td>"; echo $row['patientmeds']; echo "</td></tr>"; echo "<tr>"; echo "<td>Childs Development History</td>"; echo "<td>"; echo $row['childdevhistory']; echo "</td></tr>"; echo "<tr>"; echo "<td>Childs Leadership</td>"; echo "<td>"; echo $row['childhistoryleadership']; echo "</td></tr>"; echo "<tr>"; echo "<td>Childs Milestones</td>"; echo "<td>"; echo $row['childhistorymilestones']; echo "</td></tr>"; if (($row['childadopted']) =='Yes') { echo "<tr>"; echo "<td>Was Child Adopted</td>"; echo "<td>"; echo $row['childadopted'] ." - "; echo "(at age " . $row['adoptedage'].")"; echo "</td></tr>"; } // End Adopted echo "</table>"; echo "</article>"; echo "</div>"; } // End if CHILD echo "<div>"; // Div to store Client Insurance Info echo "<input id=\"ac-3\" name=\"accordion-1\" type=\"checkbox\" />"; echo "<label for=\"ac-3\">INSURANCE INFORMATION</label>"; echo "<article class=\"ac-auto\">"; echo "<table class=\"h3 bordered zebra-striped\">"; echo "<tr>"; echo "<td>Primary Insurance</td>"; echo "<td>"; if (($row['insuredyn']) == "None") { echo "UNINSURED"; } else { if (($row['insuranceprimary']) == "Other") { echo $row['insuredotherprimary']; } else { echo $row['insuranceprimary']; } } // End Primary Insurance Header if (($row['insuredyn']) !== "None") { echo "<tr>"; echo "<td>Primary Insurance Phone</td>"; echo "<td>"; echo $row['insurancepriphone']; echo "</td></tr>"; echo "<tr>"; echo "<td>Primary Insurance Account #</td>"; echo "<td>"; echo $row['insurancepriacct']; echo "</td></tr>"; echo "<tr>"; echo "<td>Primary Insurance: INSURED</td>"; echo "<td>"; echo $row['insurancepriname']; echo "</td></tr>"; echo "<tr>"; echo "<td>Primary Insurance: SSN</td>"; echo "<td>"; echo $row['insuranceprissn']; echo "</td></tr>"; } // Test and Display if client has both Primary and Secondary Insurance if (($row['insuredyn']) == "Primary and Secondary") { echo "<tr>"; echo "<td>Secondary Insurance</td>"; echo "<td>"; if (($row['insurancesecondary']) == "Other") { echo $row['insuredothersec']; } else { echo $row['insurancesecondary']; } echo "<tr>"; echo "<td>Secondary Insurance: PHONE</td>"; echo "<td>"; echo $row['insurancesecphone']; echo "</td></tr>"; echo "<tr>"; echo "<td>Secondary Insurance: ACCOUNT</td>"; echo "<td>"; echo $row['insurancesecacct']; echo "</td></tr>"; echo "<tr>"; echo "<td>Secondary Insurance: INSURED</td>"; echo "<td>"; echo $row['insurancesecname']; echo "</td></tr>"; echo "<tr>"; echo "<td>Secondary Insurance: SSN</td>"; echo "<td>"; echo $row['insurancesecssn']; echo "</td></tr>"; } else { // NO SECONDARY INSURANCE } // End Primary Secondary Insurance condition echo "</table>"; echo "</article>"; echo "</div>"; // End Div for Client Insurance Info echo "<div>"; // Div to store Misc Info echo "<input id=\"ac-4\" name=\"accordion-1\" type=\"checkbox\" />"; echo "<label for=\"ac-4\">REFERRAL AND CONTACT</label>"; echo "<article class=\"ac-auto\">"; echo "<table class=\"h3 bordered zebra-striped\">"; echo "<td>Courtesy Call Requested</td>"; echo "<td>"; echo $row['courtesycallyn']; echo "</td></tr>"; echo "<tr>"; echo "<td>Leave Message on Ansering Machine</td>"; echo "<td>"; echo $row['courtesycallmachine']; echo "</td></tr>"; echo "<tr>"; echo "<td>Courtesy Call Number</td>"; echo "<td>"; echo $row['courtesycallnum']; echo "</td></tr>"; echo "<tr>"; echo "<th colspan=\"2\" class=\"formheader\">Reference</th>"; echo "</tr>"; echo "<tr>"; echo "<td>Referred by</td>"; echo "<td>"; echo $row['clientreferral']; echo "</td></tr>"; echo "</table>"; echo "</article>"; echo "</div>"; // Edit Provider Function echo "<div id=\"editProvider\" class=\"modalEdit\">"; echo "<div> <a href=\"#close\" title=\"Close\" class=\"close\">X</a>"; echo "<p>Current Provider for: "; echo $row['firstname'] ." " . $row['lastname'] . " is " . $row['assignedProvider'] . "<br>"; echo "<p>Select a New Provider"; echo "<form action=\"editClient.php\" method=\"post\"> "; echo "<select name=\"assignedCounselor\">"; echo "<option value=\"Dr. Dolittle\">Dr. DoLittle</option>"; echo "<option value=\"Mr. Magoo\">Mr. Magoo</option>"; echo "<option value=\"Jerry Atric\">Jerry Atric</option>"; echo "<option value=\"Sheldon Cooper\">Sheldon Cooper</option>"; echo "</select>"; echo "<input type=\"submit\" value =\"Update\">"; echo "</form>"; echo "</p>"; echo "</div>"; echo "</div>"; } // End While mysqli_free_result($result); ?> <div align="center" class = "4u login-box"> <!-- Same row, 3 more cells --> <h2 align="center">Detail Functions</h2><br> <h3> <?php if (isset($_SESSION['display_name'])) { echo "<a href=\"receptionlist.php\">Patient List</a></br>"; // unset($_SESSION['activate']); } else { echo "<a href=\"resp_patient_info.php\">Client Registration</a></br>"; } if ($_SESSION['role'] == "Reception") { echo "<a href=\"#editProvider\">Edit Client</a></br>"; } ?> <a href="logout.php">Logout</a> </h3> </div> </div> Bottom line is i cant get the SUBMIT button to display. Thanks.
  14. Well actually, i didnt show the rest of the code but i select a user and so i only get one return in the while loop so thats not the problem. The modal pops up on top of a longer list of things.. Really my problem is getting the Submit button to display. Thanks for your reply.
  15. Two questions actually... 1. I have created a modal popup (css) with some form and php database info inside. I want to create a simple pulldown that will allow me to change the contents of one field. Heres what i have done (most of the Mysql and declarations left out for brevity) while ($row = mysqli_fetch_array($result)) { echo "<div id=\"editProvider\" class=\"modalEdit\">"; echo "<div> <a href=\"#close\" title=\"Close\" class=\"close\">X</a>"; echo "<p>Current Provider for: "; echo $row['firstname'] ." " . $row['lastname'] . " is " . $row['assignedcounselor'] . "<br>"; echo "<p>Select a New Provider"; echo "<form action=\"editClient.php\" method=\"post\"> "; echo "<select name=\"assignedCounselor\">"; echo "<option value=\"Dr. Dolittle\">Dr. DoLittle</option>"; echo "<option value=\"Mr. Magoo\">Mr. Magoo</option>"; echo "<option value=\"Jerry Atric\">Jerry Atric</option>"; echo "<option value=\"Sheldon Cooper\">Sheldon Cooper</option>"; echo "</select>"; echo "<input type=\"submit\" value =\"Update\">"; echo "</form>"; echo "</p>"; echo "</div>"; echo "</div>"; } // End While Example Output is attached. So, everything works as expected until i get to the INPUT TYPE line and i cant produce a Submit Button? Thats all. What have i done wrong or am i overlooking? 2. I realize there is an awful lot of echo statements here and wonder is there a cleaner way to code this without putting it inside the while loop but still having the DB info avaialble? Thanks.
  16. Thanks Psycho i will follow your advice and also i think i may have located sample javascript on stackoverflow. thanks.
  17. Honestly, i dont even know where to start here... or if its even possible the way i am envisioning it BUT I currently output form information from a MySQL DB - its pretty large - about 75 fields and i format them in a zebra-striped table for easy reading. Heres a small example while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>Provider</td>"; echo "<td>"; echo $row['assignedcounselor']; echo "</td></tr>"; echo "<tr>"; echo "<td>Patient Name (" . $row['childadult']; echo ")</td>"; echo "<td>"; echo $row['firstname'] ." ". $row['lastname']; echo "</td></tr>"; and so on.... } I want my receptionist to be able to click on a small icon next to any field and just be able to edit the contents and the field updates in mysql upon clicking another button (save icon). Something sorta like the scren mockup below. Is something like this do-able in PHP or will i need to add javascript.. Any ideas?
  18. Thanks for that explanation. Is helpful.
  19. Thank you that did it. I will re-read the subject of CSS descendants vs child selectors. apparently i dont understand it well enough.
  20. hello ive already gotten help on a few issues but i am doing my best to learn without asking too many questions. thanks for all your help. shak
  21. I have some basic CSS that sets the defaultstyle for all table headers. table th { padding-top: 9px; font-weight: bold; vertical-align: middle; } I also have another table in a report output that i want the headers to be a slightly different. so i thought i would create a class for them since they will appear 4 times in the report. This is what i tried. table th .formheader { text-align: center font-size: 1.5em; } And here is the html: <tr> <th colspan="2" class="formheader">Insurance Info</th> </tr> And ive attached a screenie of what it looks like but essentially its not taking the formheader stuff. Im sure i am overlooking something stupid as i am still new to this. Please assist? Thanks for looking.
  22. ok i changed the preg_match to... if (!preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/', $password)) { // no SPecial Chars $pwdfailure = "Password must contain a SPECIAL character."; return $pwdfailure; } And it seems to work ive tried a couple samples. This reg expression stuff is difficult for me to grasp. i will have to put some serious time into it when i have a chance. These examples i got from forums. thanks for your help.
  23. doh.. i get it. Now i understand what ginerjm was trying to tell me. Yes that worked. Thanks for that.
  24. i guess i THOUGHT i was creating a result when i defined $pwdfailure = "some text" based on the if statment in the brackets and then return that $pwdfailure variable?
  25. No doubt ive got this all wrong but i am trying to write a function that evaluates password strength/complexity before i hash/encrypt it and i want to give feedback toi the user about what is weak. I thought that i could create a variable to return a string depending on what the result is but i get nothing back. Obviously im still dont understand this too well. (yes still very noob to this). Thanks in advance for suggestion. function password_strength($password){ $pwdfailure = ""; if (strlen($password) < { // too short $pwdfailure = "Password must be at least 8 characters."; return $pwdfailure; } if (strlen($password) > 20) { // too long $pwdfailure = "Password cannot be longer than 20 characters."; return $pwdfailure; } if (!preg_match("/[A-Z]/", $password)) { // no upper $pwdfailure = "Password must contain an UPPER case character."; return $pwdfailure; } if (!preg_match("/[a-z]/", $password)) { // no lower $pwdfailure = "Password must contain a LOWER case character."; return $pwdfailure; } if (!preg_match("[^\da-zA-Z]", $password)) { // no lower $pwdfailure = "Password must contain a SPECIAL character."; return $pwdfailure; } if (!preg_match("/[0-9]/", $password)) { // no digit $pwdfailure = "Password must contain at least ONE digit."; return $pwdfailure; } } Then i try to test the return value with ... if (password_strength($confirmed_password)) { $pwdmismatch = $pwdfailure; // I tried this $_SESSION["pwdmismatch"] = $pwdfailure; // and this. redirect_to("loginpage.php"); } else { } And i want to echo the $pwdfaioure or $_SESSION["pwdmismatch"] where the login form is. But the string is empty.
×
×
  • 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.