I have an html file add-offer.html containing 3 forms. I collect the data from these forms with javascript and then fetch it with fetch() to the file add-offer.php. The php file contains validation of the data, which I then try to insert into a database table. There are also two more queries that need to be executed. The data is submitted and some of it is added to the database, but I get error messages 405 and 500 and the rest of the php file is not executed.
I checked whether there was an issue connecting with the database, which was not the case. All files that need to be used exist and I checked for typos in their names. I checked the names of the tables and columns I’m inserting information into – they are correct. I am also getting an error message for the POST method, so I tried to solve this issue by removing all the “method” and “action” properties from the forms themselves, because the combined data is fetched with “post” in the javascript fragment.
user1092938 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.