Pass a text fields text to a php function via post

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcmcom
Forum Newbie
Posts: 14
Joined: Thu Jan 31, 2008 7:23 am

Pass a text fields text to a php function via post

Post 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
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

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

Post 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'].
Post Reply