Creating URLs |
[eluser]eric cumbee[/eluser]
I am new to codeigniter, i am trying to form a url that passes a value to another controller function. this is the code for generating the link Code: <a >Precinct_ID);?>"> http://<serveraddress>/index.php/<mycontroller>/<myfunction>/<value to be passed> instead it is generating a url like this Code: http://localhost/list_voters/7
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter Community! I think your code for generating the link is broken... :/ site_url() should be what you're looking for. You can find it in the [url="http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html"]URL helper[/url].
[eluser]eric cumbee[/eluser]
what i do not get is that i did the same thing on another page and it worked fine and somehow seemingly at random it is getting the current function included in the url.
[eluser]eric cumbee[/eluser]
how do i post code with out the forum messing it up?
[eluser]TheFuzzy0ne[/eluser]
It shouldn't mess it up. If it does, then there's probably something wrong with the code your posting. The forum replaces < with &lt; and > with &gt;. You might need to do this manually.
[eluser]eric cumbee[/eluser]
its truncating my code big time basicly i am doing a href= set_precienct/echo ($row->County_Code) and that works fine in the first page it creates the link properly but when i do the same thing on the next page except instead of set_precienct/County_Code i use list_voters/Precienct_ID and i get set_precienct thrown into my url
[eluser]TheFuzzy0ne[/eluser]
Either make your URL absolute, or append a forwards slash to the URL. Code: <a href="<?php echo site_url('list_voters/' . $precinct_id); ?>">URL</a>
[eluser]eric cumbee[/eluser]
first way gives me http://192.168.1.20/index.php/Houdini/se..._voters/10 and the second gives me http://192.168.1.20/list_voters/10
[eluser]TheFuzzy0ne[/eluser]
What's your base_url set to in your config file? Please post your controller and view. If you put them between [code][/code] tags, it should display properly. |
Welcome Guest, Not a member yet? Register Sign In |