Creating a series of pages???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Creating a series of pages???

Post by cturner »

What I want to know is how does a page such as article.php?id=1 then article.php?id=2 be created? Does it have to created manually or is there some code that creates each page?
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

maybe with

Code: Select all

if (isset($_GET['pid'])) {
     $id = preg_replace('/[^a-zA-Z0-9\_]/', '', $_GET['pid']);    
} else {
     $id = '1';
}
and then make your SQL query something like :

Code: Select all

" SELECT * FROM articles WHERE id='$id' "
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

You can use the get method in your form tag

Code: Select all

<form method="get" action="page.pgp"><input type="hidden" name="id" value="1">
Or you can just insert it into a link

Code: Select all

<a href="page.php?id=1>Something</a>
User avatar
cturner
Forum Contributor
Posts: 153
Joined: Sun Jul 16, 2006 3:03 am
Location: My computer

Post by cturner »

Thanks guys for your help. Problem has now been solved.
Post Reply