Calling PHP functions

Ask about a PHP problem here.
Post Reply
lakc
Posts: 32
Joined: Fri Oct 21, 2011 6:05 pm

Calling PHP functions

Post 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:
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Calling PHP functions

Post 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.
Image
Post Reply