Does anyone know a good tutorial or a script for updating multiple rows in the database incl. file upload using one form?
Thank you in advance
Does anyone know a good tutorial or a script for updating multiple rows in the database incl. file upload using one form?
Thank you in advance
You just need to make sure every information is definetly linked to the corresponding row. You can use the array syntax for your input names with the row ID as a key, e.g. name[123]
. So on the server side you are able to grab all information for each row to update. You can implement a file upload like anywhere else.
@chorn Thaanks for the reply.
Ok. I have the form fields in the form like this content_id, title, content. Where content_id is a hidden field in the form
Then I receive them in the controller the following way:
if ( isset( $_POST["submit"] ) ) {
$content_id = filter_input(INPUT_POST, 'content_id', FILTER_SANITIZE_NUMBER_INT);
$title = filter_input(INPUT_POST, 'heading', FILTER_SANITIZE_STRING);
$content = filter_input(INPUT_POST, 'content', FILTER_SANITIZE_STRING);
}
How should I continue from here?
Prepare and execute the SQL statement according to the data structure you see with var_dump()
.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.