I want to insert data in the form of a columns

Because you have # in the action, the form gets processed in its self.
The header you have in the error section won’t work because it comes after there has been some html output. A header must come before any output.
To make the form redirect you can put another page in the action attribute and do the processing there. Or if you want to use a 'header` redirect, you must put the processing at the beginning of the document, before there is any html output.

There are other issues with the php processing.
You are putting unsanitised user data directly into an sql query which you should never do as it’s a huge security risk. Also you are using the obsolete mysql api, you should be using mysqli or PDO.

1 Like