
fleff
User
Nov 28, 2011, 9:27 AM
Post #1 of 4
(401 views)
Shortcut
|
|
If single record go directly to Details Viewer
|
Can't Post
|
|
The website in question has a section called "items". In it are records for several types of items. If a search for a particular type of item finds only one item for that type, my client wants to go directly to the details viewer for that item instead of going through the list viewer that would display only that one item. This is what I have put directly under the <body> tag: <?php if ($itemsMetaData['totalRecords'] == 1): { header("Location: /items_details.php"); exit; } ?> <?php endif ?> That brings up the details viewer for the first record in the section, not the record we want. If I physically add the record number in the code, it works fine. My question is, how do I append the record number of the single item in the category requested? I tried the following: <?php if ($itemsMetaData['totalRecords'] == 1): { header("Location: /items_details.php?<?php echo $record['num'] ?>"); exit; } ?> <?php endif ?> I get an error message. What should I have here to make it work? Thanks, Farnham
|