User the Same Table for 2 Links

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
testuser
User
Posts: 24

User the Same Table for 2 Links

Post by testuser »

Hi all,

I have a user table with user type IDs for each record (1=teacher; 2=student). I want to show 2 links on the menu: Teachers and Students. The teacher list has a filter "UserTypeID=1" and the student list has a filter "UserTypeID=2". Is there a way to do it with PHPMaker 10? Thanks.


danielc
User
Posts: 1599

Post by danielc »

Use Menu Editor to add your Menu Item, like Teacher and add URL as xxxlist.php?UserTypeID=1

For your table, click [Table] tab, setup [Filter]:
(isset($GET["UserTypeID"]))? "yourfield = " . $GET["UserTypeID"] . "":""


testuser
User
Posts: 24

Post by testuser »

Thanks danielc.

I tried it and there are 2 problems:

  1. I added xxxlist.php?UserTypeID=1 as a menu item "Teachers" and xxxlist.php?UserTypeID=2 as a menu item "Students". When open the teacher link, both menu item links of "Teachers" and "Students" are disabled.

  2. When I open xxxlist.php?UserTypeID=1, it shows all teachers. But when I click on the header to sort any column, it shows teachers and students.

Please let me know how to fix them. Thanks.


danielc
User
Posts: 1599

Post by danielc »

If you click on the header to sort, the table is still xxxlist.php but without the search value. So, it will show the full list.

So, you need to create a view to add the filter. Right click your table to select [Create View], add your table and tick all fields and in criteria column belong to UserTypeID row to add =1 or =2. Then Click ok (remember to change view name to teacher or student). A database view will be created.


testuser
User
Posts: 24

Post by testuser »

That works fine. Thanks.


Post Reply