Welcome Guest, Not a member yet? Register   Sign In
How can I pass variables in a foreach loop into a view?
#7

[eluser]RobertSF[/eluser]
You're welcome! Just so you know, I've since corrected a couple of errors in the source I provided. One is the missing parenthesis in if (isset($_GET['subtime']). There is an old programming language called LISP, and many witticisms arose from its use of parenthesis. The second error was that anchor_popup() must be echoed. It only generates the strong; it doesn't send it to the HTML source. I've since tested what I posted, so if you ever need a non-modal popup window, that's a way of doing it in Codeigniter.

I don't know much about Javascript, but I looked at the project page for SimpleModal, and it seems you can send data to it. The project page says
Quote:As a stand-alone function, a modal dialog can be created by passing a jQuery object, a DOM element, or a plain string (which can contain HTML). For example:
$.modal("<div><h1>SimpleModal</h1></div>");
You could pass it the value of $r->Submitted, but that value would have to be embedded in the HTML code for each row in your table, and I think you'd also need to add onclick="$.modal(....)" to the img tag in each row.

Here's what I hope is a valuable discussion about passing data generated by PHP to Javascript.
http://stackoverflow.com/questions/23740...javascript

If you've done any development in Visual Studio/Visual Basic, this will seem very different because the web operates in a stateless manner. The application runs and ends with each page load, unlike in desktop development, where the application is always running in memory. I'm pretty new at it too, and it sure is confusing sometimes! Smile


Messages In This Thread
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 08:14 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 03:19 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 07:28 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 08:17 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 09:56 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-06-2014, 08:16 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-06-2014, 05:00 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-14-2014, 03:31 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-15-2014, 06:29 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-16-2014, 09:31 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-16-2014, 05:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB