Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

best practice for a "detail" page with PHP MYSQL 1

Status
Not open for further replies.

leegold2

Technical User
Oct 10, 2004
116
Need recommendation to do the following: Let's say I have a web page display via php/mysql with abbreviated query search results. It's in tabular format for the user ie. one record ='s table row and each field in a rec/row is a "td" - pretty standard presentation...What I want to do is in each row/rec. I want to have a link or a button that opens a detailed/unabbreviated result for a particular item when the user clicks...it'll show in the same window. So I'd like to GET or POST to the exsiting window again, but it seems to me I need two items "Getted" or Posted: I need the primary or unique key for that record, and I need what I think should be a hidden field "telling the PHP" that I'm asking for the detailed view of one record ( and I'll test w/appropiate if-elseif...from that point).

If anyone follows me up till now and has a snippet or best way I'd appreciate it. Thanks, Lee G.
 
I use something like this:

<td><a href=/file.php?key=keyval>keyval</a></td>

You could add another flag to indicate that a detailed page should be returned, but I just check for the single key value. If it's not there, then there must be a different process.

 
I use different solutions for different models...

Far and away I most frequently use the one above.

I'll often add a target="someOtherWindowName" if I don't want it to be in the main window.

Alot of time's I'll use the same idea, but with an image as the source, and a javascript onClick() event (I program mostly for an intranet so I get to assume Javascript is always available)... This method can be really nice for presentation, you can place the window wherever you want on the screen, size it as you like, and add/remove things like the address bar... i.e. I have an application where you click on the calendar, and up comes a calendar, you select the date, and it posts the information back to the main window and closes the little one... last thing I want them doing there is navigating around the little window.

You could also use a form for each row with hidden values if for some reason you needed to use POST instead of GET... i.e. you were redirecting to someone elses page you don't have control over.

Last but not least, I'll use a form + javascript such that which button you click fills out some hidden fields and then submits the form.

I'm sure there are more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top