Welcome Guest, Not a member yet? Register   Sign In
Button click problem
#1

[eluser]johnmiller[/eluser]
the below is the code i wrote for search button.

Code:
<form id="search" method="post" action="../search/">
<input type="submit" name="button" id="button" value="Search" />
</form>

I have a function named 'search' in the controller (controller name is blog).
I call this function when the page loads because i need to get many values from database to this page (like state, city etc).
my search starts after that.
if i write action="../search/" in my button click, it will generate error.
so i thought of writing another function called do_search

and i wrote

Code:
<form id="search" method="post" action="../do_search/">
<input type="submit" name="button" id="button" value="Search" />
</form>


and in the controller i wrote

Code:
function do_search()
    {
        $this->load->view('search');
    }

what i want is...

moving to do_search function, passing the values to model, returning the results, then loading search page with results.

but it gives me error.

how to do that correctly?
#2

[eluser]awpti[/eluser]
Use the absolute path, not relative.

action="/controller/do_search/"
#3

[eluser]johnmiller[/eluser]
but if i use
Code:
action="/blog/do_search/"
(controller name is blog)
in each button click, these details is getting added to my address bar..

for example..
suppose the address bar in the initial stage is
Code:
../blog/search/
if i click the button once, the address bar will be
Code:
../blog/search/blog/do_search/
for the next click it will be
Code:
../blog/search/blog/do_search/blog/do_search/
#4

[eluser]awpti[/eluser]
Something about your config isn't right then.

Using action="/blog/search/do_search" makes your end result technically impossible, unless your action="blog/search/do_search"




Theme © iAndrew 2016 - Forum software by © MyBB