Welcome Guest, Not a member yet? Register   Sign In
Specific link from view
#1

[eluser]Unknown[/eluser]
Quote:Hey guys, So in a nutshell, Im wondering how to pass data from a view to another controller when a link within that view is clicked

Hi guys,

This is a great forum and thank you all in advance for any input you might have for me. I am creating a professor course tracking website where professors can create a course that they offer (engineering 101 for example) and for each course they can create and view the lectures (lecture 1, introduction for example). I am using doctrine with codeigniter based on a tutorial I saw online and I am stuck at a point where one a professor logs in, they can see the courses that they have created which is called upon by looking at all the courses logged by that professor. Similarly I want to have it so that the professor can click on a course and then is redirected to a page that shows all the lectures that are part of that course. As of now, only the courses are displayed in my view file as shown below. Is there a good way I can do this?

I have a table called courses which has course information (courseid, coursename, coursesemester, etc) and a lecture table which has lecture information and relationship with course (lecture name, lectureid, courseid)

Code:
<br><h3><strong>My Courses:</strong></h3> Click on a course to view lectures <br><br>
        
        &lt;?php
            if(count($result) == 0){
                echo "<h3> You have no courses created. </h3>";
            }
            else{
            ?&gt;
                <table width="500" border="0" cellpadding=5>
                    <th align=left bgcolor="153E7E">Course name</th>
                    <th align=left bgcolor="153E7E">Course section</th>
                    <th align=left bgcolor="153E7E">Course semester</th>
                    <th align=left bgcolor="153E7E">Course options</th>
                &lt;?php $counter = 0;
                while($counter < count($result)){
                ?&gt;
                  <tr &lt;?php echo $class = empty($class) ? ' class="altrow"' : '';?&gt;>
                    <td>&lt;?php echo $result[$counter]['coursename']; ?&gt;</td>
                    <td>&lt;?php echo $result[$counter]['coursesection']; ?&gt;</td>
                    <td>&lt;?php echo $result[$counter]['coursesemester']; ?&gt;</td>
                    <td>&lt;?php echo "(edit | delete)"; ?&gt;</td>
                  </tr>
                &lt;?php $counter++; }?&gt;  
                </table>
            &lt;?php
            }
        ?&gt;

Thanks again!
#2

[eluser]Jan_1[/eluser]
??? How could I help you?

echo anchor('controller/function/value', 'title="pass data to another controller"');

or

http://ellislab.com/codeigniter/user-gui...elper.html




Theme © iAndrew 2016 - Forum software by © MyBB