Jump to content


Photo

A script to change content for a variable


  • Please log in to reply
3 replies to this topic

#1 zbrahead

zbrahead
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 21 April 2006 - 07:55 PM

<?php
#Set Variables to content for tables depending on $page variable.
if($page = home )
    {$headid1 = "Welcome to our home-page This is your gateway to the rest of the site";
    $msgid1 = "Welcome to Era-Games Homepage, we hope you find many things to do here,our demos our currently locked down because of the people exploiting this generous service";
    $headid2 = "An Apology";
    $msgid2 = "We apologize for the adverts on this screen and as soon as possible we are working to remove these.";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
else
if($page = about )
    {$headid1 = "Welcome to the about us page";
    $msgid1 = "";
    $headid2 = "";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
else
if( $page = forum )
    { header( "location:http://eragames2.byethost7.com/forum/"); exit();
    }
else
if( $page = news )
    { header( "location:http://eragames2.byethost7.com/news/"); exit();
    }
else
if( $page = contact )
    {$headid1 = "Welcome to the Contact Us page";
    $msgid1 = "";
    $msgid2 = ""
    $headid2 = "";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
?>

$page is ascertained by an extensionj onto the url in ?page=home etc.

please help!!!!

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 22 April 2006 - 01:32 AM

a few errors in the code.
$msgid2 = ""
when it shows up for the second time you forgot to close it with the colon ; symbol, that might fix your problem.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 23 April 2006 - 12:04 AM

And if that wasn't it then tell us what the problem is.

- what is not doing that it should do?
- what is it doing that it shouldn't do?

Don't just post code and say it doesn't work if you expect help.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 23 April 2006 - 03:03 PM

The comparison operator is the double equal sign "==", you have a single equal sign in all of your "if" statements. Change it to a double equal.

You're also assuming that register_globals is enabled. You should use $_GET['page'] instead.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users