shackwm60 Posted March 7, 2014 Share Posted March 7, 2014 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. Quote Link to comment Share on other sites More sharing options...
iwpg Posted March 7, 2014 Share Posted March 7, 2014 (edited) If you look at your html code that's produced, you should notice that the form was printed for every loop! The format of your form doesn't need a loop, so you can put it above or below it. <div id="editProvider" class="modalEdit">"; <div> <a href="#close" title="Close" class="close">X</a>"; <p>Current Provider for: <?php while ($row = mysqli_fetch_array($result)) { echo $row['firstname'] ." " . $row['lastname'] . " is " . $row['assignedcounselor'] . "<br>"; } ?> <p>Select a New Provider"; <form action="editClient.php" method="post"> <select name="assignedCounselor"> <option value="Dr. Dolittle">Dr. DoLittle</option> <option value="Mr. Magoo">Mr. Magoo</option> <option value="Jerry Atric">Jerry Atric</option> <option value="Sheldon Cooper">Sheldon Cooper</option> </select> <input type="submit" value ="Update"> </form> </p> </p> </div> </div> Edited March 7, 2014 by iwpg Quote Link to comment Share on other sites More sharing options...
shackwm60 Posted March 7, 2014 Author Share Posted March 7, 2014 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. Quote Link to comment Share on other sites More sharing options...
iwpg Posted March 7, 2014 Share Posted March 7, 2014 I don't think that this would have anything to do with it, but value="Update" has a space after =. Also, you can remove the loop since it's just one record. <div id="editProvider" class="modalEdit"> <div> <a href="#close" title="Close" class="close">X</a> <p>Current Provider for: <?php $row = mysqli_fetch_array($result); echo $row['firstname'] ." " . $row['lastname'] . " is " . $row['assignedcounselor'] . "<br>"; ?> <p>Select a New Provider"; <form action="editClient.php" method="post"> <select name="assignedCounselor"> <option value="Dr. Dolittle">Dr. DoLittle</option> <option value="Mr. Magoo">Mr. Magoo</option> <option value="Jerry Atric">Jerry Atric</option> <option value="Sheldon Cooper">Sheldon Cooper</option> </select> <input type="submit" value="Update"> </form> </p> </p> </div> </div> Quote Link to comment Share on other sites More sharing options...
shackwm60 Posted March 7, 2014 Author Share Posted March 7, 2014 (edited) 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. Edited March 7, 2014 by shackwm60 Quote Link to comment Share on other sites More sharing options...
iwpg Posted March 7, 2014 Share Posted March 7, 2014 I am seeing it, on Chrome, FF, IE. It could be a CSS file? Sorry I couldn't help. Quote Link to comment Share on other sites More sharing options...
shackwm60 Posted March 7, 2014 Author Share Posted March 7, 2014 (edited) 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! Edited March 7, 2014 by shackwm60 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.