Jump to content
Larry Ullman's Book Forums

Recommended Posts

I give up!!


What is wrong with this code?


            while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){
                echo "<tr class=\"data\" align=\"center\" width=\"100%\">
                    <form action=\"edit_other_medical_problem.php\" method=\"POST\">
                        <td align=\"center\">{$row['AssessmentDate']}</td>
                          <td align=\"center\">{$row['MedicalProblem']}</td>
                          <td align=\"center\">{$row['TreatmentPlan']}</td>
                          <td align=\"center\">{$row['OtherDetails']}</td>
                        <td align=\"center\">
                            <input type=\"submit\" name=\"submit\" value=\"Edit\">
                              <input type=\"hidden\" name=\"MedicalProblemID\" value=\"{$row['ID']}\">   
                    echo "<form action=\"delete_other_medical_problem.php\" method=\"POST\">
                            <td align=\"center\">
                                      <input type=\"submit\" name=\"submit\" value=\"Delete\">
                                      <input type=\"hidden\" name=\"MedicalProblemID\" value=\"{$row['ID']}\">
                    echo "</tr>";


The "Delete" button works beautifully but the "Edit" button remains on this page instead of opening "edit_other_medical_problem.php".


I cannot see the difference.

Link to comment
Share on other sites

Are you sure about that, margaux?

I'm not saying you're wrong, but that seems weird.

I created the following quick scripts to test things out, and both forms seem to submit fine:



  echo '<form action="form1.php" method="post">
  <input type="hidden" name="a" value="a">
  <input type="submit" name="submit" value="Submit">
  <form action="form2.php" method="post">
  <input type="hidden" name="b" value="b">
  <input type="submit" name="submit" value="Submit">
Link to comment
Share on other sites

And the code for form1.php and form2.php is the same. The code is the following:

By placing the three above files in the same folder and running index.php, both forms seem to properly submit to the intended scripts.
Am I missing something?
Edit: I had to make two posts, because for whatever reason, my post kept getting cut off if I only did one.
Link to comment
Share on other sites

  • 4 weeks later...

Thanks for your input on this problem.

 It turned out that I had an error in the code where it had to decide whether Submitted was true or not.

The program thought that Submitted was TRUE and just saved the variables back to the database and returned to the calling page.


Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...