Solved

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?

Posted on 2007-11-27
5
208 Views
Last Modified: 2013-12-12
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
Comment
Question by:ayounis
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:AlexanderR
ID: 20361880
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
 

Author Comment

by:ayounis
ID: 20387956
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
 
LVL 11

Expert Comment

by:AlexanderR
ID: 20388973
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
 
LVL 11

Accepted Solution

by:
AlexanderR earned 100 total points
ID: 20388977
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
 

Author Comment

by:ayounis
ID: 20391097
That's perfect AlexanderR. Works a treat.

Many thanks.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question