Pull record based on dropdown selection |
[eluser]QuestionBoy[/eluser]
I am brand new to CI And am just starting to wrap my head around the frameworks and the power it can offer. I previously created web apps using pure PHP. In my main form there was a drop-down that the use could make a selection and upon posting the PHP would pull up that record for viewing/editing. I am now trying to do the same using CI and am lost. I don't know if there is a term for this because I have been unable to locate a tutorial for this type of thing. Yet, I am most certainly not the first person to do this. Can anyone offer some guidance, or perhaps a link to a tutorial that covers this. I was thinking it would be best to use AJAX or JSON instead of reloading the page, but perhaps someone here can offer better advice. Thank you for your patience and guidance. It truly is greatly appreciated! QuestionBoy
[eluser]InsiteFX[/eluser]
What does the selection contain for getting the record? Usally you just do you database method and use ci input to grab the form data.
[eluser]QuestionBoy[/eluser]
It should return the Primary Key value for the selected record. I truly am a newbie at this so I don't quite understand what you mean by "Usally you just do you database method and use ci input to grab the form data.", could you elaborate or is there an example you could refer me to? Thank you.
[eluser]xerobytez[/eluser]
If you have already done this in plain PHP it shouldn't be too different in CI. the flow and general idea are the same. The View File "form.php" Code: <form method="post"> The Controller "form.php" Code: <?php The Model "item_model.php" Code: <?php This is just to give you an idea of how the entire process should work.
[eluser]InsiteFX[/eluser]
This is wrong! You are just asking for xss Code: //Read the value from the form dropdown
[eluser]QuestionBoy[/eluser]
Thank you both for the help, I will test it out shortly, but at least now I see the logic. As for the XSS, can one not set an option in the config so you don't have to specify it in each post() or is this a best practice to always explicitly specify it?
[eluser]QuestionBoy[/eluser]
Just as I think I get it, I get lost. I could do this in a couple minutes in normal PHP, but am having a real hard time switching my brain over to CMV. I have a feeling once I get it functional it will become ridiculously simple to understand (as is most coding), but right now, it eludes me completly for some reason (I normally don't have problems picking up programming - famous last words). I will revisit this on a rested head.
[eluser]InsiteFX[/eluser]
You can load it in the config but it will always be loaded in memory, this way it is only loaded when you call it. CodeIgniter User Guide - Form Validation CodeIgniter User Guide - Form Helper CodeIgniter User Guide - Input Class CodeIgniter User Guide - Security Class |
Welcome Guest, Not a member yet? Register Sign In |