Jump to content
Pardon our ads (a necessary update) ×

Leaderboard

Popular Content

Showing content with the highest reputation on 10/10/2025 in all areas

  1. the simple way of doing this is to use an array for the data, by using an array name for the form fields, with the array index being the row's unique id, e.g. name='court[{$data['ccalid']}]'. when the form is submitted, you can get the array indexes from the first field (see php's array_keys()), then loop over this array of indexes to access each set of data from the fields. also, you should not put dynamic values directly into sql query statements, where any sql special character can break the sql query syntax. use a prepared query instead, prepared once, before the start of any looping, then simply supply each new set of data when you execute the query. if is seems like using the mysqli extension with prepared queries is overly complicated and inconsistent, it is. this would be a good time to switch to the much simpler and better designed PDO extension. here's a list of general points for the posted code - modern php (8+) uses exceptions for database error handling by default. when using exceptions, no discrete error checking logic will be executed upon an error and should be removed. when using exceptions, your code will only 'see' error free execution. if execution continues past a statement that can throw an exception, you know there was no error without needing any logic to test the result of the statement. if this is the only form that can submit to this page, you don't need to test if the submit button is set. in fact, there are cases where the submit button won't be set and you should not attempt to test if it is. use 'require' for things you code must have. include/require are not functions. the () around the path/filename do nothing and should be removed. to get a form to submit to the exact same url of the current page, leave out the entire action attribute in the form tag. everything in the ...ccal table is for the ccal data. there's no good reason to include 'ccal' in every column name. this is just a bunch of extra typing you have to keep track of. you need to apply htmlentities to all dynamic values being output in a html context to prevent any html entity in a value from breaking the html syntax. textarea's don't have value attributes.
    1 point
This leaderboard is set to New York/GMT-05: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.