Welcome Guest, Not a member yet? Register   Sign In
$_GET doesn't work
#1

[eluser]penta997[/eluser]
Helo. Does someone know, why I cant get value from $_GET??
This is my form code:
Code:
<div id="wyszukiwarka">
                 &lt;form name="spendfrm" action="&lt;?php echo base_url();?&gt;index.php/ksiegarnia/get_books_by_keyword" method="GET"&gt;
                     &lt;input type="text" name="szukaj" /&gt;
                     &lt;input type="submit" name="wyszukaj" value="wyślij" /&gt;

                     &lt;/form&gt;
        </div>

and this is part of controller:
Code:
function  get_books_by_keyword($key='')
       {
                      
                      if(isset($_GET['szukaj']))
                      {
                          echo 'dupa';
                          $key = $_GET['szukaj'];
                      }

When I'm running an application the text field is empty.
#2

[eluser]cideveloper[/eluser]
have you tried $this->input->get('szukaj')
#3

[eluser]Cristian Gilè[/eluser]
Set uri_protocol in your config.php to PATH_INFO.


Cristian Gilè
#4

[eluser]steelaz[/eluser]
I would also recommend using site_url() when building URLs in CodeIgniter, so instead of

Code:
action="&lt;?php echo base_url();?&gt;index.php/ksiegarnia/get_books_by_keyword"

use

Code:
action="&lt;?php echo site_url('ksiegarnia/get_books_by_keyword'); ?&gt;"
#5

[eluser]InsiteFX[/eluser]
If running CI 2.0.0

Try this in application/config/config.php :
Code:
$config['allow_get_array']        = TRUE;

InsiteFX
#6

[eluser]penta997[/eluser]
Quote:I would also recommend using site_url() when building URLs in CodeIgniter, so instead of

action="&lt;?php echo base_url();?&gt;index.php/ksiegarnia/get_books_by_keyword"
use

action="&lt;?php echo site_url('ksiegarnia/get_books_by_keyword'); ?&gt;"
doesnt work.
Quote:Set uri_protocol in your config.php to PATH_INFO.

Still the smae error "Undefined index: szukaj"
#7

[eluser]MVUG[/eluser]
Set uri_protocol in your config.php to QUERY_STRING.
#8

[eluser]penta997[/eluser]
Now I ahve :"The URI you submitted has disallowed characters."
#9

[eluser]penta997[/eluser]
Ok maybe is an another solution .I've decided to use a $GET instead $this->input->post() becouse $this->input->post() did not work. My problem is connected with text filed. I want to serch results based on word witch I'll write into this filed. And display it into the view. But in my pagination function only items from first link displaying, when I'm click in 2nd link and site was reload the value from text field lost and there are displaying all of item from my table. Just like in sql statement like function have '%%'
instead '%word%'
#10

[eluser]nedimtx[/eluser]
Why don't you try:

Uri class:
http://ellislab.com/codeigniter/user-gui...s/uri.html




Theme © iAndrew 2016 - Forum software by © MyBB