Hello all,
I've built a small PHP script for my website which consolidates about 10 different pages into one. Let me explain.
The code structure is a little like this:
HTML Code for page up until content is required
PHP inserts content here depending on which page was requested
Footer HTML
I've done this using the CASE function in PHP, and at present it looks like this:
So a request for the page looks like:PHP Code:<?php
// Start PHP script.
switch($_SERVER['QUERY_STRING']) {
case 'pageone':
echo "content for page one";
break;
case 'pagetwo':
echo "content for page two";
break;
default:
echo "normal index";
}
index.php?pageone
And if there's any sort of typing error, such as
index.php?page one
It will serve up the "default" page.
However, this isn't exactly what I want to happen.
I'd prefer that when a typo is hit, that some content is served stating that there was an error in the request, rather than just serving the default page.
Is this possible? I'm rather new to PHP.
(My current PHP is www.gerryhyh.f2s.com/paul/content/index.php, and the code can be found at http://www.gerryhyh.f2s.com/paul/content/php.txt (which I know is completely uncompliant. I'm working on that)
Regards,
cr3ative



)
Reply With Quote
Bookmarks