Page 1 of 1

Calling PHP functions

Posted: Sun Nov 27, 2011 8:03 am
by lakc
Hi,

I have a form with action="checkquery.php"

In the checkquery.php, I hv several functions func1, func2, func3 for routine sql operations.

So my question is, how can i call a specific function of checkquery.php within the form.action attribute like

form action="checkquery.php?insert_student_records()". (this is WILD thinking :idea: ) Of course in MVC frameworks it would be URI segementing in the form class/function/params1/params1

Cos my desgin aim is to use multiple views of .html which consists of different data of different webpgs to be directed to checkquery.php.

The checkquery will do the mysql operations and return the results back to the .html pages.

The solution I can think of is using hidden fields to identify which view the form data is collected in the checkquery.php, verify the value then perform the msyql operation. Is there better alternate solution??

I know it may look as if I am trying to dig a "underground pass" thru MVC frameworks minus M and C. :twisted:

Re: Calling PHP functions

Posted: Sun Nov 27, 2011 1:41 pm
by jacek
Well I have no idea what you are trying to do, but you can send a $_GET variable in the action="" like
<form action="something.php?action=erm" method="post">
You could then use $_GET['action'] to decide which function to call.

There is no way to do it directly like you suggested.