Re: Calling a program

From: Date: Mon, 30 Nov 2015 06:12:58 +0000
Subject: Re: Calling a program
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-325260@lists.php.net to get a copy of this message
On Nov 29, 2015, at 9:31 PM, Ken Robinson wrote:
At 11:36 PM 11/29/2015, Ethan Rosenberg wrote:
Dear List - Can you not call a PHP script from a form -- action = 'program.php'? In my hands it does not work... I have tried the following include program.php; later in the program ... form . . echo "<input type='hidden' name='next_step' value='step14' />"; . . . . switch ( $_POST['next_step'] ) {
       case 'step14':
       {
               P7a.php();
       }                                                               }
} //end Switch The result of this is that program.php runs at the start of the script, and step14 is never called. I am totally confused. If you need more details, please specify. TIA. Ethan
Why are you including the script you want to start from the form? You need to show us more of your script. Normally you have a form <form action='program.php' method='post'> <input type='hidden' name='next_step' value='step14' /> <input type='submit'> When the form is submitted, the script 'program.php' is invoked. Ken
also, in your switch case 'step14' the script P7a.php would either have to be a function that is declared in the processing script, or, if in a separate file, would have to be included for it to be run. The name you use has .php. you would not invoke it the way you do, unless there is a function specifically declared and defined as 'P7a.php'. But the .php suggests that it is a separate script file. JK

« previous php.general (#325260) next »