Here’s the setup:
I have an initial starting page – let’s call it A.php.
Pathname for A.php: Localhost/A.php
A.php contains a form that extracts input from the client then processes it by calling a function – b(). b() kicks off some processing which nests down to a function f(). Once at f(), we then want to go back to the client and ask for some more input, before branching:
Code: Select all
Require_once ‘path_to_G/G.php’;
$result = prompt_user($options);
If ($result == ‘a’) {
// do A
} else {
// do B
}
} // end f()
Code: Select all
Code: Select all
function prompt_user($options) {
?>
HTML form here
<?php
if (isset($_POST[‘submit’])) {
// Capture users’ selection
$response = $_POST[‘choice’];
return $response;
}
>?
Code: Select all
How do I get my form displayed, and capture what’s POSTed without prompt_user() returning prematurely?
I’ve also tried first redirecting to G.php before trying to throw up the form, but then the program stack is lost and I can’t get the $response back to the calling function. (f()) Any ideas?