Page 1 of 1

Pass a text fields text to a php function via post

Posted: Thu Jan 31, 2008 3:27 pm
by mcmcom
hi all,
one more beginner question for ya.

I have a textbox, and a submit button and this php code. How do i get the posted val from the text box into the PerformSearch method as a parameter. do i just go "PerformSearch(form[0][0]) ?

Code: Select all

 
include 'FTSearch.php';
 
if(isset($_POST['Submit'])) {
    $ftSearch = new FTSearch();
    $testarray = $ftSearch->PerformSearch(mytextboxvar); // << need the text in here
    foreach($testarray as $elm){
        echo $elm . '<br>';
    }
}
 
TIA,
mcm

Re: Pass a text fields text to a php function via post

Posted: Thu Jan 31, 2008 3:42 pm
by Zoxive

Code: Select all

print '<pre>';
print_r ($_POST);
print '</pre>';
$_POST is the global array holding all post data.

If you named your field `Test` you would use $_POST['Test'].