问题描述:

I'd like to make subpages within the same page, using if isset(get) to show the subpages.

I have a page: page.php and a subpage: page.php?do=userList and I'd like to make other subpage using the same URL: page.php?do=userList&id=123

This is my code (page.php):

if(empty($_GET)) {

?>

<a href="page.php?do=userList">User List</a>

<?php

}

if (isset($_GET['do']) && $_GET['do'] == 'userList') {

// the user list

echo '<a href="/page.php?do=clientList&id=' . $row['mID'] . '">' . $row['name'] . '</a>';

}

if (isset($_GET['id'])) { // ???

// user info

}

Can I use that URL but showing only the content of: "if (isset($_GET['id']))"??

If is set $_GET['id'] don't show $_GET['do']... :P

网友答案:

Just add && !isset($_GET['id']) to your second if statement.

相关阅读:
Top