![]() |
Get value from selected form_dropdown() - 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: Get value from selected form_dropdown() (/showthread.php?tid=28644) Pages:
1
2
|
Get value from selected form_dropdown() - El Forum - 03-17-2010 [eluser]bondjp[/eluser] You're right, i was just reading about it... Well what i want to do next is build an url with this and other data that's ready and have a button to pass the data to my controller where i will use uri->element(id) and save the values to the several dbs that i have. How can i proceed to do this? what's the best way? Get value from selected form_dropdown() - El Forum - 03-17-2010 [eluser]bondjp[/eluser] Something link this: Code: <?php $confirm='controller/method/'.$time.'/'.$name.'/'.$why;?> $why is what i will append to my url... Get value from selected form_dropdown() - El Forum - 03-17-2010 [eluser]danmontgomery[/eluser] http://api.jquery.com/jQuery.ajax/ is probably what you're looking for. Get value from selected form_dropdown() - El Forum - 03-18-2010 [eluser]dark_lord[/eluser] [quote author="bondjp" date="1268865411"][quote author="WishBear*" date="1268865245"]Workaround? alert(x.selectedIndex + 1);[/quote] Ok the value starts at 0 so no need to work around :)... Now how can i pass this value and use it in my php code?[/quote] I thought you'll just need the value inside a form, not passing it to PHP Code, hehe.. anyway, you might need Ajax for that to be able to pass the client side variable to the server side, I agree with the folks that help you out also here. Get value from selected form_dropdown() - El Forum - 03-18-2010 [eluser]bondjp[/eluser] Yeah. Thanks. I had to change this a bit so here's what's happening. I now have 2 dropdown boxes. I click the first and the second shows the info based on the first one. It's not working right because when i click the first dropdown the second gets populated with the last values in the database. Here's what i'm saying: Drop1 Drop2 Drop3 DB: Id1 Item for Drop1 Id2 Item for Drop1 Id3 Item for Drop2 Id4 Item for Drop2 Id5 Item for Drop3 Id6 Item for Drop3 Whenever i select drop2 or 3 the next dropdown gets populated with Id5 and Id6. I've checked and it seems that my selected choice in the first dropdown isn't getting passed to the controller. I did an Alert window and shows "Object object" so no value is getting there. Can you help see what's wrong with my code? Thanks. View: Code: [removed] Controller Code: function ajaxcity() Ajax City View: Code: <?php foreach($searchcity as $row) : |