Re: Calling a program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 Nov 2015 at 20:43, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: 

> On 30 November 2015 20:40:55 GMT+00:00, Curtis Maurand <curtis@xxxxxxxxxxx>
> wrote:
>
>> On 11/30/2015 3:33 PM, Ashley Sheridan wrote:
>>>
>>> $script_result = shell_exec('p7a.php');
>>>
>>> There is a lot of useful information here once you get past the snide
>>> comments at the top.

>> http://stackoverflow.com/questions/8450696/execute-a-php-script-from-another-
>> php-script

>>> On 11/29/2015 11:36 PM, 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.

>>> shell_exec is *not* the right method here. As others have pointed
>> out, it appears there's a lack of understanding about how the PHP stack
>> works with regards to requests and logic.
>> Maybe not, but it can be done that way.  I never said it was correct.
>> The right way would be to write a class and use the methods of that
>> class to do what you need based on the choice made.
>
> Generally, if you're in a situation where shell_exec is the solution,
> something went wrong with the question. I've only used it once, and that was
> when I didn't know any better

As far as I could tell from the OP, the OP appeared to believe that if he had as it might be:

  <form action='program.php'>

in his html, then in order to execute program.php he had to include it in that same html file and that it would be executed in his browser. That is, not understanding what happens where. BICBW.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux