Reading form Data ($_POST or $_REQUEST)?

#1
[eluser]fireproofsocks[/eluser]
I'm new to CI... I got basic pages working per Derek's great video tutorials, but I'm having trouble processing a form. It's a basic search form where user types in a word, then I perform a SQL query fetching rows based on that word. However, I can't seem to read any data from the $_POST array... I've tried using both $_POST, $_REQUEST, and I've tried using CI's

My form looks like this:

Code:
<?php echo form_open('search/results'); ?>    
    <p>
    <label for="searchterms">Search Terms: </label>
    &lt;input type="text" id="searchterms"&gt;
    &lt;input type="submit" value="Search"&gt;
    </p>
    
&lt;/form&gt;

And then my search.php's "results" function looks like this:

Code:
function results() {
        $searchterms = $this->input->post('searchterms');
        // $searchterms = $_POST['searchterms'];
        // $searchterms = $_REQUEST['searchterms'];

        echo "Search terms were:<br/>";        
        echo $searchterms;
    }

Nothing ever makes it through, though... what am I missing?

#2
[eluser]elvix[/eluser]
your searchterms input needs a name attribute. -> name="searchterms"

#3
[eluser]fireproofsocks[/eluser]
Lol. Thanks.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.