![]() |
Creating URLs - 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: Creating URLs (/showthread.php?tid=16463) Pages:
1
2
|
Creating URLs - El Forum - 03-07-2009 [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 Creating URLs - El Forum - 03-07-2009 [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]. Creating URLs - El Forum - 03-07-2009 [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. Creating URLs - El Forum - 03-07-2009 [eluser]TheFuzzy0ne[/eluser] Can you give a better example? Creating URLs - El Forum - 03-07-2009 [eluser]eric cumbee[/eluser] how do i post code with out the forum messing it up? Creating URLs - El Forum - 03-07-2009 [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. Creating URLs - El Forum - 03-07-2009 [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 Creating URLs - El Forum - 03-07-2009 [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> Creating URLs - El Forum - 03-07-2009 [eluser]eric cumbee[/eluser] first way gives me http://192.168.1.20/index.php/Houdini/set_precienct/192.168.1.20/index.php/list_voters/10 and the second gives me http://192.168.1.20/list_voters/10 Creating URLs - El Forum - 03-07-2009 [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. |