How to display sub-detail page from tabular page

Ask about a PHP problem here.
Post Reply
lakc
Posts: 32
Joined: Fri Oct 21, 2011 6:05 pm

How to display sub-detail page from tabular page

Post by lakc »

Hi,

I know how to display the multiple records in a table with a few selected columns.

But there are more details that I cant display in the same tabular page.

Therefore, when i click on any of the first values of a index col of any record, i should be displaying a full detailed page of that record.

So please verify with me. I would need to store the id of the record i click (each index value in the col for every record will be hyperlinked), which in turn is stored in hidden value.

Then i query the db to return the full complete record matching that id. Now heres the problem how can i make it display the results in a new frame or new window at the instance event of click????

Many thanks,
Lak.
Last edited by jacek on Thu Feb 23, 2012 11:12 pm, edited 1 time in total.
Reason: Fixed title.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Hw to display sub-detail page from tabular page

Post by jacek »

In your first table you can link to another page like view_item.php?id=<the_id> then on the second list you can link to view_details.php?item_id=$_GET['id']&id=<the_id>

Essentially this will keep the id in the URL.
Image
lakc
Posts: 32
Joined: Fri Oct 21, 2011 6:05 pm

Re: Hw to display sub-detail page from tabular page

Post by lakc »

hey jacek can u explain this more further in detail coding...

simple codings for both
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: How to display sub-detail page from tabular page

Post by jacek »

Well say you have you first page that shows the list of all records, the id of each one could be linked to a new page like this
<a href="view_record.php?id=<?php echo $record['id']; ?>">Some Text</a>
Then when clicked it will take the user to the page view_record.php?id=7 where 7 would be replaced with that records ID.

You can get the id in the new page by using $_GET['id'] and use that to decide which row from the database to take the information form.
Image
lakc
Posts: 32
Joined: Fri Oct 21, 2011 6:05 pm

Re: How to display sub-detail page from tabular page

Post by lakc »

Can I do it without the url param passing... like a function call to class...it would need the "require" statement...

So the <a href> perhaps would hv the call statement.... is this possible...???

By the way guys i want to verify

<?php Class className functionName(){ } ?> ok..so save this using className as fileName.php.... is it the same as className.java
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: How to display sub-detail page from tabular page

Post by jacek »

lakc wrote:Can I do it without the url param passing... like a function call to class...it would need the "require" statement...

So the <a href> perhaps would hv the call statement.... is this possible...???
Not really no, Think of it in terms of page requests. Once your browser is done loading the first page it closes the connection completely and reopens a new one when you click the link. There is no way for it to send information to the server other than through the URL requested.
lakc wrote:<?php Class className functionName(){ } ?> ok..so save this using className as fileName.php.... is it the same as className.java
You can save it as whatever you like really. The accepted standard seems to be the same as Java so className would be in ClassName.php. I tend to ignore this and save class_name in class_name.inc.php just because that's what I'm used to.
Image
Post Reply