![]() |
Posting data to uri segent? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Posting data to uri segent? (/showthread.php?tid=58717) |
Posting data to uri segent? - El Forum - 07-11-2013 [eluser]spyridonas[/eluser] Is it possible? i have a search and the result url is "mysite/find" but i want the url to be "mysite/find/value" (where value whatever i put inside the input box) what i have so far is : Code: $route['shop/find/(:any)']= "shop/find/$1"; Code: function find($findV) Code: <?php echo form_open('shop/find/','find'); ?> Posting data to uri segent? - El Forum - 07-11-2013 [eluser]Ckirk[/eluser] rather than using the form helper to create a form I'd use plain html and omit the action. That way your form would post as per the URI and would pick up $findV, without having to try and pass it as a hidden field eg. Code: <form method="post" accept-charset="utf-8" /> Posting data to uri segent? - El Forum - 07-11-2013 [eluser]spyridonas[/eluser] hmm with the simple form the results are the same , if i try to put the variable here Code: $this->load->view('shop/content/find',$data); Code: $this->load->view('shop/content/find/'.$inputSlug,$data); Posting data to uri segent? - El Forum - 07-12-2013 [eluser]Ckirk[/eluser] Now you've lost me. Are you saying that you have multiple views with different names that match whatever is being passed in through findSlug? Seems a bit uncontrolled Posting data to uri segent? - El Forum - 07-12-2013 [eluser]spyridonas[/eluser] No i have one controller , one viewer its just that the text i write if i post it and get the data works fine , but the url is /find/find?=(text_here) , what i want is make it /find/(text_here) and i tried doing it by sending the variable (findSlug) on the view loading part (the logic was that the viewer will load with the value next to it , in this case , find/(my_text) ) If i modify my viewer to search the variable that's in the 3rd url segment it works fine , but i can't pass this 3rd segment simply by loading the viewer with it , or redirecting to this viewer, or if there's a way to pass the post or get variable to the uri cleanly. I think the solution is to grab the enter key with jquery and automaticly redirect to my url/find/input_value and done with it.. i mean there is no way that i can pass data to the url? a $data['url'] ? $this->url->setsegment ? |