Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/13/2022 in all areas

  1. edit: it turns out the main problem isn't in the form or form processing code - the reason for the incorrect operation of the form(s) is because the markup on the page is broken. there's an opening <form .. tag on line 33 in navbar.php, for a search feature, that is never closed. since nested forms are invalid, any <form tag after that point on the page is ignored. i determined this by noticing the browser address bar changing to include the form field values, meaning a get method form was in effect. since the intended form is a post method form, i searched through the code to find all form tags, leading to the one on line 33 of navbar.php, with no corresponding closing </form> tag. you need to validate all your resulting web pages at validator.w3.org some items for your form processing code - the form processing code and the form should be on the same page. this results in the simplest code and the best User eXperience (UX.) the form processing code should first detect if a post method form has been submitted, trim, then validate all the input data, storing user/validation errors in an array using the field name as the array index, then only use the data if there are no validation errors. if there are validation errors, you would display them when you re-display the form and re-populate the form field values with the existing values so that the user doesn't need to keep reentering data over and over. they can just correct the validation errors. the only redirect in your code should be to the exact same url of the current page to cause a get request for that page. this will prevent the browser from trying to resubmit the form data if the user reloads the page or browses away from and back to that page. if you want to display a one time success message, dialog box, alert,... store the message in a session variable, then test, display, and clear that session variable at the appropriate location in the html document.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.