How to send a data from a table to a form in codeigniter - codeigniter

I'm totally new to CI. I am working on the project that fetch data from a db and send it a particular data to a form on a click of a ADD button. Here is the screen shot of my table..enter image description here
Here is the screenshot of my form..
enter image description here

Your add button should collect the data it needs, send it to controller, and controller passes it to model so it can collect the data that you need by sql. Pass it back to controller and controller passes the data to the view ( your form . In your view you just put the data where ever you need.

Related

What is the naming convention for Laravel store confirmation dialog

I have a form to create a new resource (for example a new user account). When the form is submitted, I want to show a summary of the data which the user has just submitted before actually storing this data. Under this summary, there is a confirmation button. When the button is clicked, the data is actually stored in the database.
What is the naming convention for the routes and controller methods in the following operations?
Displaying initial form
Submitting the form and responding with summary
Pressing the confirmation button and storing the data

After submitting the form, I want to stay at the same page and display the data

When I fill my employee form and performance details and click "to submit" button, I want it to show all the data on the same page and I want the form to become empty so that I can refill the form for the same employee again.
screenshot
Use redirect_to :back in your controller to, what for it, redirect back to the previous page (or more accurately HTTP_REFERER)
To ensure the form data is blank, the model it is rendered on should have blank fields with something like #performance_report = PerformanceReport.new.
If you want to show both the old data and the blank form, you will need your controller to create two instance variables, one showing previous data, and one empty.

Joomla modal popup target url does not get session value

I have a problem regarding modal popup and session.
I have two component name test and test1 respectively.
In test there is a form in view in which i put "Anchor" tag with "modal" class. has also class name "class1".
When i clicked on Anchor tag it call click function(on click "class1") in which i put ajax code for set data using "Session".
$('.test').click(function(){
// Ajax code here for set data using session
});
with above function it also called modal popup. here targer url is seted which is the view of 2nd component which is "test1".
Here in test1 there is a view.html , we are getting session data here and displaying in view.
PROBLEM
Problem is that , here in 2nd component , in view i am getting session data but i need to click on button two time , only after i getting data properly.
When i click on it give me a old session data. and when i click on it second time it will give me a proper data.
What is the solution for above problem. if anyone know please let me know.
Session data is altered only after we click on Anchor tag.
Both thing is done on Anchor click , one is for set data in session and second is for modal popup. in popup i am getting data which set in session.
when is the session data is being altered?
Is it altered by ajax call too?
In this case, javascript, is unsynchronous. It doesn't wait for something to happen in order to fire the next line of code. In that case there are several techniques you may find to do so.

How to filter page content according to dropdown box selection in cakephp 2.x

I have a select box in my view.ctp , it shows some content from the controller, but my problem is i want to load content dynamically according to the droapdown selection
i tried with making ajax request on onchange of selection in the select box. but the problem is ,the select box id is sending to the controller function, their i set the content for display .but the page is not refreshing..
I dont know which logic sholud use for this purpose..if anybody have an exerience with this..please replay me..
In order to achieve those results you should follow the next steps:
Create an action that returns the content with $this->layout = null
Create a view for this action that displays the content in the way you desire (html with no css)
In the view that you like to fetch that content through AJAX make a request that pulls that controller and view
append it where you want it on your page (with proper css on the page you make the request it will display correctly)

MVC3 Display search result on the current view (without any new view created)

I am pulling some data from a databse and displying it in a list like in this example. I want to implement a search on the top of the page to search the value of the data reurned on the page. This example creates a new view for the search page. Is it possible to implement a search on the current view without creating a new view for the search results.
I don't mind doing it with a new view, but I am just wondering
The view doesn't need to care about what you are doing in the background with the data. It simply displays whatever you are sending to it in a formatted pretty way. Because of this there is certainly nothing wrong with supplying a parameter in a search box and then pushing this to the controller when clicking a search button. The controller will then be doing the requests to your model or repo to filter the data culminating in a return of your view loaded with the data it has found, exactly as it would on your initial load (just now with less data than it did before). There should be no need to create a totally different view for this, the view is just your template for returned data.

Resources