The form input will be inside a "<FORM...>" tag. That tag will specify a "method" attribue of "GET" or "POST".
If you submit a form to a PHP script, the values will appear automagically in the PHP predefined variables $_GET or $_POST, depending, respectively, which method you specified in your form. There is some good documentation for this in the PHP online manual:
I don't understand what you want to do with the value after you have processed it. I think that your question indicates a misunderstanding about how web applications work.
A console application is a continuous dialog between a user and the appliction. The program runs the whole time, reacting to user input and producing output for the user.
Web applications are not continuous. When you point your browser to a script on a web server, the script runs and produces output for your browser to render. Then the script stops running completely. So instead of a single, long conversation, web applications are sets of multiple short conversations between a user and the application. Unless the browser is actively fetching information from a script running on a server, your application is not running.
So in terms of the web, it seems to me what you want to do is accept input, have PHP process it and produce a second form which the user can submit to another script.
What follows is a short PHP script that demonstrates the discontinuity of web apps. The first time it is run, nothing will have been submitted to the script, so the script produces a blank form. If form data has been submitted, the script takes the text entered in a field named "the_text", reverses it, then outputs the form with the input field pre-populated with the submitted string reversed:
Code:
<?php
if (array_key_exists('the_text', $_POST))
{
$the_string = strrev($_POST['the_text']);
}
else
{
$the_string = '';
}
print '
<html><body>
<form method="post" action="test_reverse.php">
<input type="text" name="the_text" value="' . $the_string . '">
<input type="submit">
</form></body></html>';
?>
Want the best answers? Ask the best questions: TANSTAAFL!!