<code>
I have a problem that hopefully someone can help me with.
I am using a php function to return straight html to a php page. I want to generate a form using a function (stored in a library)and then have the results of the form passed to the same page for processing by the same function.
My problem is that the post parameters that i pass to the page are not being seen by the function.
It's really not as complicated as it may sound. Here is a very simple example that tries to print the data entered from a very simple form.
First the code that appears on our main page (here called test.php)
<?php
#our library that stores our code
require '../code.lib'
#print our code from the function called code
echo code()
?>
here is the code from our library (save in a file called code.lib and put in same dir as the test.php)
<?php
#make a function to create a form and then display it's results
function code() {
$html = "<form method='post' action='test.php'>";
$html .= "<input name='field' value='help'>";
$html .= "<input type='submit' value='click'>";
$html .= "<br> you wrote ". $HTTP_POST_VARS['field'];
return $html;
}
?>
when you first run the page it should show the field and if you hit the button it should tell you what your wrote.... but for me it doesn't seem to be able to read the variable.... any advice?
thanks!!!!
chris
</code>