Jump to content
Larry Ullman's Book Forums

Return Specific Sections From An "include" File

Recommended Posts

Hello everyone,


this is a quick question about the PHP include() function. Is it possible to pull in specific sections of an include file? Such as:  include ("inc/menu.php #div1");


The following code snippets are both in the same include file but they need to be called separately. Should I wrap these in functions? The table can probably be assigned to a variable.

# Script 10.5 - #5
// Determine the sort...
// Default is by registration date.
$sort = (isset($_GET['sort'])) ? $_GET['sort'] : 'rd';

// Determine the sorting order:
switch ($sort) {
    case 'ln':
        $order_by = 'last_name ASC';
    case 'fn':
        $order_by = 'first_name ASC';
    case 'rd':
        $order_by = 'registration_date ASC';
        $order_by = 'registration_date ASC';
        $sort = 'rd';
echo '<table align="center" cellspacing="0" cellpadding="5" width="75%">
    <td align="left"><b>Edit</b></td>
    <td align="left"><b>Delete</b></td>
    <td align="left"><b><a href="view_users.php?sort=ln">Last Name</a></b></td>
    <td align="left"><b><a href="view_users.php?sort=fn">First Name</a></b></td>
    <td align="left"><b><a href="view_users.php?sort=rd">Date Registered</a></b></td>

Thanks in advance!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...