Google Answers Logo
View Question
Q: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP*********** ( Answered 5 out of 5 stars,   4 Comments )
Subject: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP***********
Category: Computers > Programming
Asked by: helpandrersearch-ga
List Price: $5.95
Posted: 14 May 2003 06:32 PDT
Expires: 13 Jun 2003 06:32 PDT
Question ID: 203566
How do I make a page change automatically? Like a file named test.html
and it has a script in there for sample and I punch in:
and then the page changes??

Request for Question Clarification by sgtcory-ga on 14 May 2003 07:27 PDT
Hello helpandrersearch,

Can you please offer a little more insight? Do you wish to make a page
redirect to another?

Thanks for the clarification -


Clarification of Question by helpandrersearch-ga on 14 May 2003 08:28 PDT
Hi sgtcory-ga,

No, I mean something like punching in the question mark (?) and the
page changing such as
then the page changes from the regular page. "page changing" means
that the page will display something else than what is in the file
because of the question mark telling to display something else. I
think this requires MySQL. I'm not sure. I've got MySQL. Also I am
using my own server (IIS 5.1) and maybe for ATL Networks (Red Hat

Thank you

Clarification of Question by helpandrersearch-ga on 15 May 2003 05:52 PDT
Is there any script I have to put in the SSI file for it to connect to the database?

Request for Question Clarification by sgtcory-ga on 15 May 2003 07:46 PDT
Hello helpandrersearch,

I am certain myself or another researcher will be able to assist you.
You may want to consider opening new questions or reviewing the
question pricing guidelines, as the answers will require more in depth
analysis than your List Price would typically cover.

You can review the pricing guidelines here:

Answers Pricing Guidelines

Request for Question Clarification by errol-ga on 19 May 2003 20:15 PDT
Hi there!

Do you have the use of PHP on your web server?

If so, I would be willing to give you a quick answer to either:
a) set it to include a different page or file depending on the
b) set it to select records from the database and include them on the

This would have the effect that you desire of changing content as seen
on so many websites (even Google:

Kind regards,

Clarification of Question by helpandrersearch-ga on 20 May 2003 08:23 PDT
Hi, errol-ga
Yes, I have PHP on my server. I also have those other things that may
be required such as CGI. I host with ATLNetworks. (standard plan)
There website is in case you need to know anything
els (that I may not know such as what I have).


Request for Question Clarification by errol-ga on 20 May 2003 08:30 PDT
Thank you for your clarification.

However, I still need to know something.
Do you need to know how to simply display different pages (include
different html content in the current page) by changing the part after
the "?" or is it more complicated than that, maybe with MySQL?

Kind regards,

Clarification of Question by helpandrersearch-ga on 20 May 2003 08:31 PDT
Do you think $5.95 would be enough for answering this question? By the
way, your document was very good, I learned alot but I don't
understand how the page will know that those values are in MySQL.


Clarification of Question by helpandrersearch-ga on 20 May 2003 08:36 PDT
I don't know how to explane this to you,but I think it is just putting
other stuff in 1 document but not having it load the default page when
you just do the page and no question mark (?). Then Ipunch in the
question mark then the page changes when I click Enter. After the
question mark (?) then the page changes with
whatever=trivaquestion122. If this is not enough then please ask
questions such as What version of PHP do you have?

Subject: Re: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP**********
Answered By: errol-ga on 20 May 2003 09:47 PDT
Rated:5 out of 5 stars
Hello again, Helpandrersearch.

I'll give you two examples, the first with file includes and the
second with the MySQL data inclusion.
I'll try to make it as easy as possible to understand.


Contents of "index.php":

switch ($page) 
    case "1":
    case "2":
    case "3":

The above code tells the script to load whichever file is determined
by the variable "$page".
For example, to load page 2 ( you would write

Contents of "":

<title>Default Page</title>
<h1>Default, this is what people will see if they go straight to
index.php with no ? on the end.</h1>

Contents of "":

<title>Page 1</title>
<h1>Page 1</h1>

This is "" which contains basic HTML.
Developers use the ".inc" extension to help them determine which pages
are includes and which are not when viewing the contents of the web
You can include any type of file and use any file extension, for
example page1.html or picture.jpg.

Try using a text editor such as Notepad to copy and paste the above
examples and save them using the correct file extension (index.php,, and etc) to test them on your

For more on "case switching" and file includes, visit the following



// Enter your MySQL database information below

$host = "localhost";
$db = "MYSQLDATABASENAME (usually username with db on the end)";

// Connecting to the database

$link = mysql_connect ($host, $user, $pass);
$q = "SELECT * from $table";
$results = mysql_db_query ($db, $q, $link);

// Depending on what the value of $data is ( or ),
// it will select the corresponding data from the database table that
you specified above.

switch ($data) 
    case "1":
	$q = "1";
        echo $results; 
    case "2":
	$q = "2";
        echo $results; 
        echo 'No row specified'; 

mysql_close ($link);

To use this, simply use then put
number 1 or 2 on the end.
You can change the variable to whatever you need for your database.
For example, if you had a database with the rows "name" and
"phonenumber" you could use
There is a lot more that you can do than this, but it does take time
to learn.

For more on MySQL and PHP, view the following sites:


I hope this helps you understand it a little more.
Kind regards,

Related Google searches:

"php mysql"

"php switch"

Request for Answer Clarification by helpandrersearch-ga on 06 Sep 2003 12:19 PDT
I was going to create a page with this script right now, however I am
asked the following:

Null/Not Null

I am not sure what it should be. Also, what type should it be. The
types I am able to create are:


Also, on the field "field", should "page" go there or should "1" go
there? Then, for the string field should "1" or "page" go there?

Also, sorry for the long time it took for me to pay for this answer, I
was on a vacation then when I got back to my home I checked my email
and I received a few of emails from Google Answers regarding the
payment, I know that the vacation was long, sorry about that.

Thank you,
helpandrersearch-ga rated this answer:5 out of 5 stars and gave an additional tip of: $3.95
Thank you for the answer errol-ga!! It was very useful. I learned alot from it also!

Subject: Re: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP***********
From: sgtcory-ga on 14 May 2003 09:33 PDT
Hello helpandrersearch,

I believe what you are seeking is a little more in depth than I can
offer for the listing price, as we would have to walk through several

This process takes a little understanding of at least one language(of
choice), but I'll attempt to outline :

Essentially what you would be doing is some server side processing.
MYSQL is simply a database to store your information, although the
variables/strings that you wish to create could be passed in and out

You would need to utilize some type of language (PHP, Perl, Java) to
have the variables in the URL parsed or passed through for further
processing. A variable/string in your example could be as simple as
something like this :

The variable would be 'question', and the string value would be

A typical application of this example? We could just say that your
variable question returns a dynamic answer. When a user 'visits' the
above URL, the answer is generated by :

- Your server processing the string - using whatever language you have
- Pulling the data for the answer you have stored in MYSQL (or any
other DB)
- Displaying the answer for the variable

I hope this helps - and I hope I didn't confuse you ;-) It's a rough
outline, but I wanted to make it easy to understand.

Subject: Re: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP***********
From: helpandrersearch-ga on 20 May 2003 08:33 PDT
I give you a 5-star rating.
Subject: Re: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP***********
From: sgtcory-ga on 20 May 2003 14:25 PDT
Looks like a great answer ;-)

I will help you in the future should you still need it. Thanks for the
great comments.
Subject: Re: *********HELP******** HTML PAGE CHANGE AUTO $2.01 ***********HELP**********
From: errol-ga on 20 May 2003 18:40 PDT
Many thanks for your kind generosity Helpandrersearch!

PHP is a wonderful language to learn and also very, very powerful.
It is always my top choice when coding a web site. :)


Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy