parkourmumbai
New Member
- Messages
- 34
- Reaction score
- 0
- Points
- 0
Is it possible to give a call to a function from the 'action' attribute of a form tag, instead of the action attribute set to another webpage or a php page?
I have a dynamically generated webpage which displays comments for a particular aspect of my website, sort of like comments are displayed in wordpress blog articles.
But I'm not using any blogging/CMS/or other package for the website, the entire thing, backend/frontend/business logic et al, is hand-coded.
In the page, the comments are displayed below the data with which they are connected, and at the bottom I have a small form with 2 inputboxes and 1 textarea to enter the comment along with the person's details.
When the user clicks the submit button, I need my php scripts within the webpage to do some complex checking and validation, give the user a javascript dialog box if any fields are left blank or don't pass validation, and pass an insert statement to the db using parameterized queries, and refresh the page to display the latest comment. So all my code for the webpage itself, the form processing, the interactions with the db at the time of insert, and the validation, needs to be on a single webpage.
I am encapsulating most of the validation and insert functionality into a function, and need to know if it is possible to send a call to the function from the action attribute of the form tag, instead of having it navigate to another page/file which holds all the processing code.
I have a dynamically generated webpage which displays comments for a particular aspect of my website, sort of like comments are displayed in wordpress blog articles.
But I'm not using any blogging/CMS/or other package for the website, the entire thing, backend/frontend/business logic et al, is hand-coded.
In the page, the comments are displayed below the data with which they are connected, and at the bottom I have a small form with 2 inputboxes and 1 textarea to enter the comment along with the person's details.
When the user clicks the submit button, I need my php scripts within the webpage to do some complex checking and validation, give the user a javascript dialog box if any fields are left blank or don't pass validation, and pass an insert statement to the db using parameterized queries, and refresh the page to display the latest comment. So all my code for the webpage itself, the form processing, the interactions with the db at the time of insert, and the validation, needs to be on a single webpage.
I am encapsulating most of the validation and insert functionality into a function, and need to know if it is possible to send a call to the function from the action attribute of the form tag, instead of having it navigate to another page/file which holds all the processing code.