I created a list and detail page using Developers Toolbox and from the detail page, I want to be able to get to a series of other pages, all using the ID from the detail page.

So...here's my example. You login and search the mbrlist.php page for your user. Based on their ID, it loads their information into the mbrdetail.php detail page.

Once you get to this mbrdetail.php page, I want the user to be able to get to other pages such as mbrevents.php, mbrsocieites.php, etc. But I want the ID that was loaded in original detail page to carry through.

I'm extremely new to PHP and DT, so I'm wondering if this is possible and if so, is a URL variable the best way to do it?

If yes, how would I do this?

I appreciate any/all help.
Thanks for your time.

Recommended Answers

All 5 Replies

I am in no way familiar with DT, but I think I know what you're asking. On the mbrdetail.php page, you could make links to mbrevents.php, mbrsocieites.php, etc like so:

<a href="mbrevents.php?id=<?php echo $_GET['id']; ?>">Member Events</a>

This is, of course, assuming that the member's id is passed in the URL as the variable 'id'. If it is not, simply change it in the small line of code I gave you. The $_GET global variable is used to retrieve information sent to a page via a form using get, or a variables passed via the page's URL.

Yeah, good stuff. After a few hours of playing around with it, I started stripping tags and ended up using GET to get what I needed.

Now the issue is...it carries the ID over in the URL but my list query won't limit the results to just that ID.

So on the information page, there's a link...

eventlist.php?Id=<?php echo $row_rsodb_members['Id']; ?>

And the list page that the above links points to has the query...

SELECT odb_mbr_events.soc_id, odb_mbr_events.date_notified, odb_mbr_events.date_event,  odb_mbr_events.description, odb_mbr_events.id, odb_mbr_events.mbr_tbl_id, odb_lst_societies.id
FROM odb_mbr_events, odb_lst_societies
WHERE odb_mbr_events.mbr_tbl_id = sessvar1 AND odb_mbr_events.soc_id = odb_lst_societies.id  AND  {$NXTFilter_Recordset1}
ORDER BY {$NXTSort_Recordset1}

Sessvar1 =

$_GET['Id']

So again, the information page has the link with the URL variable.
That information is transferred to the next screen and the ID does show up, but the list still shows all events, and does not limit the results to the ID specified.

Any suggestions?

Thanks so much for your help.

Ok so I got it pulling the correct information. Sweet!
But now...and this is where I'll need the help...

I have a table that has a list of states in it. All with ID's. For example, Connecticut = 5.
So in my query,

SELECT odb_mbr_events.soc_id, odb_mbr_events.date_notified, odb_mbr_events.date_event,  odb_mbr_events.description, odb_mbr_events.id, odb_mbr_events.mbr_tbl_id, odb_lst_societies.id
FROM odb_mbr_events, odb_lst_societies
WHERE odb_mbr_events.mbr_tbl_id = sessvar1 AND odb_mbr_events.soc_id = odb_lst_societies.id  AND  {$NXTFilter_Recordset1}
ORDER BY {$NXTSort_Recordset1}

Something is wrong. I want the odb_lst_societies.id (remember, CT was 5) to show up as the word Connecticut, not the number 5.

So Basically I need odb_lst_societies.id (the number that represents the state) to be equal to odb_mbr_events.soc_id (the number for each state).

When I write the query as above, my page comes up blank. No idea why.

Do you have phpMyAdmin accessible? Usually when writing a query that can get complicated, like this one, I copy and paste the query into phpMyAdmin and replace the PHP variables with something that would work, like a user ID of 5 for example. Then MySQL with show you the errors in your SQL syntax and it may help you better understand what's going on. The query may also just be coming back blank.

So in your databases, do you have the names of the states saved in a column? If so you would need to identify that in your SELECT at the beginning.

I hope some of that helps.

I hope some of that helps.

It definitely does. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.