[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

With a master - detail list of db values spanning 3 pages, how do I stop the list defaulting back to page 1 after a value has been selected?

Okay - very unclear question title. Sorry. I'll try to explain.

Basically I have a master - detail type page which is drawing information from a MySql database. On the right hand pane of my webpage are a list of names of teachers (master). Clicking on these names reveals more information on these teachers (details) in the left hand pane of the website.

There are 20 teachers listed in the list of teachers on the right hand side pane. Clicking on the arrows at the bottom of the pande, reveals the next 20 teachers in the database, and so on.

The problem is that if I am viewing the second page of teachers (i.e - not the first 20, but the next 20) and I click on one of the teacher names to see more information, the information is displayed BUT the list refreshes back to the first 20 which were on the list.

Essentially, when I click on a teacher name to view details, how can I stop the page from going back to display the first 20 (or whatever value I specified) in the DB.

An example of this problem can be viewed at:
http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7299

If you press the arrow button at the bottom if this screen, it will take you on the next list of teachers and if you select one of these, the list refreshes to display the first 20 in the db.

Many thanks for reading this.
0
Adam
Asked:
Adam
  • 3
  • 2
1 Solution
 
AlexanderRCommented:
It should really be in an iframe of some kind so it stays the same and does not waist resources when you click around.
But as a quick fix, around each name in the list you need to have something like


echo '<a href=http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7267&pageNum_m='.$_GET['pageNum_m'];
basically put &pageNum_m='.$_GET['pageNum_m'] at each link in the list

Open in new window

0
 
AdamTrying to learn phpAuthor Commented:
Thanks AlexanderR.
Sorry about the late response to your solution. I can't really code, and am having some problems implementing your solution. The line of code which I guess you are referring to is this one:

<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

And the link to the details is on the 'firstname' link.

Where should I put the '&pageNum_m='.$_GET['pageNum_m']' link on this line?

Thanks
0
 
AlexanderRCommented:
I hope we are talking about the same links here.  On the link that you provided, each teacher record has links similar to http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7233 not the kind in your latest post.

But if they both share the same pageNum technique it doesn't matter.  You should modify the links in your code to look like
<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?pageNum_m='.$_GET['pageNum_m'].'&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

Open in new window

0
 
AlexanderRCommented:
sorry
<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?pageNum_m=<?php echo $_GET['pageNum_m']; ?>&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

Open in new window

0
 
AdamTrying to learn phpAuthor Commented:
That's perfect AlexanderR. Works a treat.

Many thanks.

0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now