Jul 27, 2008

Cant Get A Script To Work - PHP

Free Web Hosting, No Ads > General > Hosted Members Area

free web hosting

Cant Get A Script To Work - PHP

Florisjuh
I've been trying to get my website urls to work with an variable in the url to navigate. The script I use is:
CODE
 <?php
 switch ($page) {
 case "home":
  include home.php;
  break;
 case "members":
  include members.php;
  break;
 case "diplomacy":
  include diplomacy.php;
  break;
 case "scrims":
  include scrims.php;
  break;
 case "forums":
  include forums.php;
  break;
 default:
  include home.php;
  break;
 }
;?>

And I specify the hyperlinks as index.php?page=home etc
But it doesnt work, am I doing something rong in this script?

Reply

electriic ink
Don't understand half the script, but the first thing I would do is put speech marks or apostrophes round the include statements. Eg:

CODE
include bla.php;


Becomes.....

CODE
include "bla.php";


What kind of error do you get?

Reply

Microsoft
i use a little bit of php and lots of html, html is so much easier for stuff. so i use html for mostly all of the stuff including the navigation. i know hardly anything about php i might learn it one day but not sure. Is using php better or something?

Notice from BuffaloHELP:
Do not go off topic.

Reply

thablkpanda
Ah! Exactly what I was trying to do a few weeks ago-

You have to use the 'get' function to get the URL in the address bar first-

I don't remember how to do it exactly, but browse the PHP programming section.

That's the 'crucial' part you're missing. But on the other hand, good work with the cases- just won't work here biggrin.gif

Panda

Reply

SystemWisdom
Try something like this:

CODE

<?php
 switch ($_GET['page']) {
 case "members":
  include 'members.php';
  break;
 case "diplomacy":
  include 'diplomacy.php';
  break;
 case "scrims":
  include 'scrims.php';
  break;
 case "forums":
  include 'forums.php';
  break;
 default:
  include 'home.php';
  break;
 }
?>


I hope that helps!

Reply

SystemWisdom
Omg, sorry, I overlooked one more thing, the "include" part is actually a function, so it should have the () brackets.. Also, you should use the require() or require_once() functions when doing what you're doing, something like this:

CODE

require( 'members.php' );

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : script, work, php

  1. Friend's Tough Financial Situation, No Work
    (3)
  2. Php Guest Online Script
    (2)
    make an index.php copy and paste this code CODE <?php $db_host = "localhost";
    $db_user = "root"; $db_pass = ""; $db_name = "test";
    $dbc = mysql_connect($db_host, $db_user, $db_pass); $dbs =
    mysql_select_db($db_name); $tm = time(); $timeout = $tm -
    (30*60);
    if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR
    "];} else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}....
  3. Mailserver Fails To Work
    (1)
    I've my Domains hosted in Trap17. My Account is suspended due to lack of enough points, but I
    was able to use the Google Apps for Domains for checking out my mail. But recently I'm not able
    to send or receive any mail, I think the problem is in the MX Record which I've set in trap17
    cPanel. When I access my domain http://laschatz.info/ I get the Account suspended page which is
    the usual page, but I'm not getting that page when I access my Addon Domains xatre.info, it is
    pointing to ComputingHostst name servers. Is there anything I need to do to make ....
  4. Why Doesn't This Code Work On Computinghost?
    (2)
    Here is the script: Rcon Connection Client IP: Port: Password Cmd:
    $ip = $_POST ; if (!$ip) die(); $port = $_POST ; if
    (!$port) die(); $pass = $_POST ; if (!$pass) die(); $passlen =
    strlen($pass); $cmd = $_POST ; if (!$cmd) die(); $cmdlen =
    strlen($cmd); $packet = 'SAMP'; $packet .= chr(strtok($ip,
    '.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));
    $packet .= ch....
  5. User Name
    blimey this is the hardest work ever (0)
    Hi, I knew nothing about chaos until I signed up (and paid for my web space Order #2486 >
    Invoice #6589) with you and I drive in London for a living ... 8 hours after sign up and still
    don't know whether my User name and password work on cPanel or anywhere on this site for that
    matter. I would suggest that the admin send out an introductory eMail on sign up with all our info
    and put a sticky on at the start page of the forum containing standard info for all users. Like FTP
    eMail and cPanel settings. The other thing that's fascinating is the 3 domains us....
  6. Phpizabi Social Network Script
    (1)
    Hello everyone not been on for AGES! we had net problems and i had to move to qupis and now
    I've got problems. I'm making a social networking site using this script and I cant get it
    to install Everytime I go to the install page i get this QUOTE Warning: session_start() :
    open_basedir restriction in effect. File(/home/kasiks1/tmp) is not within the allowed path(s):
    (/home/karlos:/usr/lib/php:/usr/local/lib/php:/tmp) in
    /home/karlos/public_html/phpazi/install/index.php on line 1 Fatal error: session_start() : Failed
    to initialize storage module: file....
  7. How To Make A View New Post Script?
    (5)
    Ok so i'm still working on the forum software i posted about a while back, but I have no idea
    how to do this. I want to make a view new post script, as this is one of the main things that my
    forum software dose not have that all other forums have. so does any body have an idea on how i
    would do this? Thanks.....
  8. Amazing Software
    I found this amazing software, if you work with flash.. (0)
    If you work with flash, this is the coolest software i seen.. You can make amazing things for the
    desktop.. check it out.. www.swfmagician.com ....
  9. Guessing Php Script
    (0)
    I am looking for: freeware php quess the person in the photo game script....
  10. Advice On A Girl From Work.
    (9)
    So there's this girl at work, we'll call her Shaniqua. I work relatively close to Shaniqua
    several days a week. We've become pretty good friends and hang out once in a while. We text/chat
    all the time, etc. The problem is Shaniqua is drop dead gorgeous. I mean like a perfect 10 model.
    I'm not a bad looking guy by any means, but I'm not Patrick Dempsey either. She's
    constantly getting hit on/asked out by other guys from school (university) and work and she always
    turns them down straight away (granted they're usually annoying or prodding too mu....
  11. Taking Phone Calls At Work
    (2)
    A potential client's first contact with the company is usually through the phone, so it is
    important that you make it a pleasant experience for him. Important phone etiquettes to bear in
    mind: When answering the phone, identify your company, department and state your name immediately
    name e.g. This is from the of . When talking to customers, call them by name. By repeating the
    name, you are more likely to remember it the next time. It also sounds more personalized and
    friendly. Know how you sound like to others. You can find this out by recording your voice.....
  12. Need Help Installing Dolphin Community Script!
    (5)
    I'm not sure if this is the right place to post this but I really need help in installing the
    dolphin community script. I have absolutely no previous experience of scripts or programming. I
    would really appreciate if someone could walk me through it step-by-step, or even do it for me by
    logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
    sure it won't take very long at all for someone who has done this before.....
  13. Database With Mysql++
    getting mySQL++ to work with trap17 (7)
    Hi, I'm trying to build an online game and figured the easiest way to do the server list would
    be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
    website and I always get an abnormal program termination; however, it will work with the mySQL on my
    own machine. The code is below: CODE #include <iostream> #include <iomanip>
    #include <mysql++> #include "pass.h"//holds my password (i program at
    school) int main(void) {     Connection con("t3jem3_test","....
  14. Ie 7 Issue With Ajax
    Some ajax calls dont seem to work (2)
    function reload_char() { race_id = Ext.get('race').dom.value; gender =
    Ext.get('race_gender').dom.value; face = Ext.get('race_face').dom.value; hair_id =
    Ext.get('race_hair').dom.value; // race race_letter =
    Array('H','E','T','M','G'); race = race_letter ; /*
    //gender if(race == 'G' || race == 'M') { gender = ''; } //hair
    if(hair_id == 1) { hair = 'a'; } else { hair = 'b'; } image =
    '80px-'+race+gender+face+hair+&....
  15. Loaing Script
    (3)
    hello, I'm looking for a preloader script for my site. like it will display an loading
    image while the site is loading and the once the page has loaded the image will disapear. i tryed
    searching for one on google but i could not find one, i think i searched for the worng thing. if
    some one knows how to make one or where i can find one that would be great. Thanks....
  16. Invite Script..
    (2)
    I didn't know where else to put it /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> If moderators find another forum more suitable plz move this one
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I am looking
    for some sort of sript or program that let's people on your website invite friends. Like they
    put in their Emailadress and mails are send to everyone in their list.. I hope someone can help me
    /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Greetzz....
  17. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
        background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
    folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
    create an index.php file and copy/paste the following script. CODE <?php $hour =
    date('H'); if ($hour < 12 ) {     $image =
    "morning.png"; } ....
  18. Html Code Tester. Online Script
    (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  19. Ctrl + C Will Not Work
    Windows Xp Pro SP2 (17)
    I recently built a computer, everything seems to be alright with it, except one thing, CTRL + C just
    won't work. I'm running a Windows Windows Xp Pro SP2, and Ctrl + X and Ctrl + V work fine.
    I mean, I could probably just cut and paste anything I want to copy but it seems like such a hassle.
    Has anyone came across this problem before? Or know how to fix it?....
  20. Evilboard (forum Software) - Multiple Categorys - Don't Work :(
    I am creating a forum and i can't fix more then 1 category. (6)
    I am at the moment trying to program my own forum, but i need more then a single category, here is
    my source: CODE function cat () { include("functions/functions.php");
    echo '<table width="100%"  border="0" cellspacing="0">
    <tr> <td class="eb_top" colspan="3" style="border-bottom-width:
    0; height: 30px; font-size: 12px;"> <b>Forum</b></td>
    </tr>';      global $catid;   $db = new db;   $db->connec....
  21. Remote Assistance Problem
    Won't work (7)
    I have tried tons of times and i can not get it too work. I did't even know about this until
    Paul from Trap 17 used it to help me with something on my site. Whenever i try it, it never
    connects. I have tried all three ways. Email, MSN, and download the file and send it. Both computers
    are connected to the internet. On microsoft's site they have a lot of people with the same
    problem, but no one ever helps with it. They are all unanswered. Paul: If you read this i know you
    know how to do it.....
  22. Idea For A Overunity/perpetual Motion Device
    Though I know it probably won't work (9)
    Well, though a way for such things has never been discovered, I'm giving my idea for a perpetual
    motion device, though it was originally thought up as a device for overunity. It's pretty
    simple - attatch a generator directly to an electric motor, then run a cord to the electric motor,
    and hand crank the generator to start it. Anyone else have an idea for a perpetual motion device?....
  23. Linux Question: Amarok And File Permissions
    please help, i can't get it to work with all music files (4)
    hey, i use to use Linux DC++ to download music from some hubs and i usually download it to
    /home/downloads/ and then i move the files to my collection on another HDD a sata one, on
    sda3/music/ but when i move the files using krushader root mode they become posessed by root and
    amarok can't play them displaying a locker on the file's icon. I tried to " chmod 774 music
    ", where music is my music directory, as root in konsole but no luck. What should i do to make a
    whole directory accessible from amarok as user?....
  24. Watermark Your Image With Simple Php Script
    found it on the net (34)
    This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
    Scripts site. Just in case the site may not show, I will include the code here: List of things
    needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
    script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
    image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
    transparent gif image with the watermark - goes in the same directory as this script // ....
  25. Razr Problems
    Keypad Doesn't Work (17)
    Hello, Can anyone help me? I own a Motorola Razr V3 and the only key that works is the on off
    button. I have never dropped it and i take excellent care of my phones. It was working fine for a
    few months and one day it just stopped working. The screen still works and I can awnser phone calls
    by opening the flip part, but I can't call anyone or text or anything that requires pushing a
    button unless it is to turn it on or off. I hace looked online and it seemse other people ahve had
    this problem but no one ever had a solution. Should I try to fix it? Should I ....
  26. How To Make Your Pc Work Faster
    get your pc working unbelievably fast in 5 minutes !! (16)
    Here you can find useful tips you can do to make your pc work faster in a few minutes , just follow
    these tips and you will definitely have a much faster and more reliable PC! QUOTE 1.
    Wallpapers: They slow your whole system down, so if you're willing to compromise, have a basic
    plain one instead! 2. Minimizing: If you want to use several programs at the same time then
    minimize those you are not using. This helps reduce the overload on RAM. 3. Boot Faster: The
    'starting Windows 9x , xp' message on startup can delay your booting for a couple ....
  27. Free Weather Feed Script
    (1)
    If you are tired of providing your clients with weather feeds that take visitors off of their site
    or slam their site with ads, I finally found one after searching for hours. Here's a link to a
    FREE php script that pulls the feed directly from any airport in the world to your site. It is easy
    to customize and has simple, well documented installation instructions.
    http://www.mattsscripts.co.uk/mweather.htm hope you find it helpful... a good one for designers
    to archive as you will most likely need it some day for a client. Check out Matt's other free
    scripts....
  28. Games = Tough Work?
    Do You Sweat Whilst Playing Games? (21)
    Well a few weeks ago I was playing Tony Hawk's Underground 2 on my Xbox and I was furiously
    trying to beat my high record combo. After about a hour of this I was actually sweaty and I just
    felt like stopping playing and have a shower. Does anyone else sweat when they play games?
    Message from snlildude87: /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
    ....
  29. Php Quiz Script
    Make quizzes for your site. (20)
    Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
    doesnt do anything special but I am going to make an email mod for it so that it will email results
    to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
    editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
    <html> <head> <title><? echo "Gamers Pub $qid";
    ?></title> </head> <body> <p><h3><? echo "....
  30. Could Someone Make A Php Script For Me?
    Script to manage clans and players (3)
    Does someone know a script where you can 1. Add clans to a roster 2. Edit clans on a roster 3. Add
    players too a clan 4. Edit players 5. Schedule matches 6. Add clan Leaders to manage their own clan
    + members 7. Add members to edit their own information And maybe some sort of scoreboard integrated
    where you can put Wins, Draws and loses and that automaticly puts best clans on the top? If there
    isnt such a script could someone create 1 for me? (its for a league ^^)....

    1. Looking for script, work, php

Searching Video's for script, work, php
Similar
Friend's
Tough
Financial
Situation,
No Work
Php Guest
Online
Script
Mailserver
Fails To
Work
Why
Doesn't
This Code
Work On
Computinghos
t?
User Name -
blimey this
is the
hardest work
ever
Phpizabi
Social
Network
Script
How To Make
A View New
Post Script?
Amazing
Software - I
found this
amazing
software, if
you work
with flash..
Guessing Php
Script
Advice On A
Girl From
Work.
Taking Phone
Calls At
Work
Need Help
Installing
Dolphin
Community
Script!
Database
With Mysql++
- getting
mySQL++ to
work with
trap17
Ie 7 Issue
With Ajax -
Some ajax
calls dont
seem to work
Loaing
Script
Invite
Script..
Background
Image Swap
Script -
Change a
Background
Image based
on clock
time
Html Code
Tester.
Online
Script
Ctrl + C
Will Not
Work -
Windows Xp
Pro SP2
Evilboard
(forum
Software) -
Multiple
Categorys -
Don't
Work :( - I
am creating
a forum and
i can't
fix more
then 1
category.
Remote
Assistance
Problem -
Won't
work
Idea For A
Overunity/pe
rpetual
Motion
Device -
Though I
know it
probably
won't
work
Linux
Question:
Amarok And
File
Permissions
- please
help, i
can't
get it to
work with
all music
files
Watermark
Your Image
With Simple
Php Script -
found it on
the net
Razr
Problems -
Keypad
Doesn't
Work
How To Make
Your Pc Work
Faster - get
your pc
working
unbelievably
fast in 5
minutes
!!
Free Weather
Feed Script
Games =
Tough Work?
- Do You
Sweat Whilst
Playing
Games?
Php Quiz
Script -
Make quizzes
for your
site.
Could
Someone Make
A Php Script
For Me? -
Script to
manage clans
and players
advertisement



Cant Get A Script To Work - PHP



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE