I have a form in a static html file.
I wish to send / pass / submit the info from this form to a script which contains functions. I want the processing script to know which function I am trying to access and pass the values to it accordingly.
I am currently:
In static html page:
<form method="post" action="user.php?action=funtion_name">
<--- fields--->
</form>
So these submitted values will be sent to the php script...which then has to receive and decide what to do with these values...
I am currently coding:
$action_type=$_GET['action']; //receives the values submitted
switch ($action_type) {
case function1: //check if the 'action' is function1
fucntion1($val1,$val2) //run the function with the values
break; // exit as action has been done
case function2:
function2($val1)
break;
case function3:
function3($val1)
break;
}
I really want to check that this is the best way to carry out this kind of value passing. It seems to work but I am concerned that it might not be best practise as I am only learning php this week.
Thanks for your help.....