Trap17.com :   Mar 21, 2010
Open Discussion Forums > MODERATED AREA > Trapper's Secret HideOut

Cant Get A Script To Work - PHP

free web hosting
Open Discussion Forums > MODERATED AREA > Trapper's Secret HideOut

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?

Comment/Reply (w/o sign-up)

cmatcmextra
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?

Comment/Reply (w/o sign-up)

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.

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

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!

Comment/Reply (w/o sign-up)

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' );

Comment/Reply (w/o sign-up)



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*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Script Php

  1. How Do I Make The Login Script? - (16)
    i want to add a login script to my page, can anyone tell me how??? thanx in advance!...
  2. Anyway To Make A "how Many Times Played" Script? - Help.. (3)
    http://www.myownworld.trap17.com/games/ I was wondering, is there anyway to make a php script so
    I can put a thing under the thumbs like "This game has been played # many times" or something? I
    mean maybe like how many times its been clicked cuz that might work...I dunno I was just wondering.
    If there is a way(I'm sure there is..) could someone tell me? thanks. EDIT: oh and yes I have
    the right to use those games on my site, funflashgames lets you freely do it as long as you have the
    comment in the source(which I do, I changed it but it gives credit and thats all...
  3. Phpizabi Social Network Script - (2)
  4. 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 ^^)...
  5. Upload Script To Transfer Files From Laptop To Desktop - (3)
    Would it be allowed to have an upload script to transfer text files (homework) from laptop to
    desktop? Because my printer is set up from my desktop, and most of my homework is done on my laptop.
    So would this be allowed? Thanks....
  6. Have There Been Any Changes? - PHP script not working anymore. (1)
    Hi, I was wondering if any changes have been made to the PHP and/or MySQL section at trap 17. All of
    a sudden a PHP script is beginneng to give errors where it never did before. I have a greeting card
    system on my website, and all of a sudden, when I try to add a card I get a load of errors, while I
    have not changed any code. These ar erthe errors i am getting: CODE Warning:
    imagecreatetruecolor() : Invalid image dimensions in
    /home/mrdee/public_html/kaart/admin/classes/class_images.inc.php on line 200 Warning:
    imagecopyresampled(): supplied argument is not a vali...
  7. Request For Coders (lots To Do) - Assisting on the Development of a Forum Script (1)
    I recently got involved in a Forum software script which is being developed and thought I should let
    everyone know that they need some assistance in the PHP, MySql, Html, and CSS areas. Also, some
    Visual Designers would be quite useful. AEF Forum Software is the name of the project. It is
    presently in version 1.0.3, and have some pretty cool features already, but in order to advance in
    its standings against such Boards as IPB, phpbb, Yabb, etc, more features and Themes are required.
    Good bunch of people working hard, but just not enough of us to do everything. Come h...
  8. Different Log In Script... - (6)
    Ok well i picked out a new log in script..
    http://evolt.org/PHP-Login-System-with-Adm...tures#authorbio And now I get errors, like i had
    before I guess, but I still get errors. I installed everything properly, and idk why I get these
    errors.. on login screen: QUOTE Warning: session_start() : Cannot send session cache limiter
    - headers already sent (output started at /home/enrit/public_html/include/constants.php:94) in
    /home/enrit/public_html/include/session.php on line 46 and on registering screen: QUOTE
    Warning: session_start() : Cannot send session...
  9. Help With Running A Cgi Script - (2)
    i am having a problem running a cgi script written in perl in my site , the path to perl and file
    permissions and anyother thing that may cause a problem i have checked and found none , the response
    i get is 500 , internal server error ,i am pretty new to perl but i am sure it's nothin wrong
    with the code , so if anybody can throw me a light on what may be wrong i will be most grateful
    ,thanks in anticipation...
  10. Fantastic Script - How ? (2)
    Hi all iam sorry posting here but i think here admins read my post i write some script like famp3 ,
    fanewsletter , famail and .... and i submit my script at hotscripts i want to know how can send my
    script in Fantastic at cpanel for example phpbb it show in Fantastic or wordpress it show at
    Fantastic and users can install script by 1 click i want my script locate at Fantastic with cpanel ?
    cpanel admin or developers must add my script or server admin can add my script in Fantastic !
    thanks...
  11. Script Error With Domain Name Changing - (8)
    I am trying to change my domain name... and it is not working for me... CODE Warning:
    mysql_real_escape_string(): Access denied for user: 'nobody@localhost' (Using password: NO)
    in /home/trap17/public_html/process/changedomain.php on line 71 Warning:
    mysql_real_escape_string(): A link to the server could not be established in
    /home/trap17/public_html/process/changedomain.php on line 71 Warning: mysql_real_escape_string():
    Access denied for user: 'nobody@localhost' (Using password: NO) in
    /home/trap17/public_html/process/changedomain.php on line 72 ...
  12. Coppermine Photo Gallery - Security Alert - For members using this script (1)
    As reported: QUOTE TITLE: Coppermine Photo Gallery Multiple File Extensions Vulnerability
    SECUNIA ADVISORY ID: SA20211 VERIFY ADVISORY: http://secunia.com/advisories/20211/ CRITICAL:
    Moderately critical IMPACT: System access WHERE: From remote SOFTWARE: Coppermine Photo Gallery
    1.x http://secunia.com/product/1427/ DESCRIPTION: A vulnerability has been reported in Coppermine
    Photo Gallery, which can be exploited by malicious users to compromise a vulnerable system. The
    vulnerability is caused due to an error in the handling of file uploads where a filenam...
  13. Help In A Php Script - (1)
    i am having phpnuke in my site and one very important thing i need to have in my site is a
    user's page where his profile and all his friends profiles will be appearing and he can add ,
    delete or accept friends , i know php basics only so if i try to write the script myself ( i mean i
    think i can do if i try ,like i have enabled images to be uploaded in sig for my phbb forum which by
    default as you will be knowing only has text to be dispalyed as sig , and took me whole three days
    to complete it , i also searched the net and downloaded some mods but none of them seeme...
  14. Adress Book Importer Script - Required free (4)
    can some one tell me where i can find a script in php , which imports the email adresses from adress
    books and send them mail ?? for example in many community websites , there is an option that , if
    some one gives his/her email and password..then they import the email adresses from that persons
    adress book or tell that it was wrong password etc.....
  15. Cgi Files? - where does this script belong? (6)
    hello guys, it's been a couple of days that i dont know where this script must be placed and in
    which format...i know it is from perl but what format should i use .pl or .cgi, yep i am a newbie
    /rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
    i also saw that there is a folder in my directory called cgi-bin, do i have tu put it there?
    QUOTE #!/usr/bin/perl $recipient = "me@somemail.com"; # watch out for backslash $mail =
    "/usr/sbin/sendmail"; if($ENV{REQUEST_METHOD} eq 'POST') { read STDIN, $buffer, ...
  16. How To Add From A Script Users To Webprotect? - adding users outside cpanel (6)
    hello guys i was wondering how to add new users allowed to poen cartain folder but added from a php
    script or something. In fact i want just my friends see that folder but as soon as they register,
    they are granted inmediatly with the selected user and password they chose, is it possible? how? and
    where to add them?...
  17. Forum Script Addon - Help Needed (1)
    Hi, I am running a phpBB Forum - the one that I got from my cPanel. There is something that I want
    to be able to do and I am unsure how to do it. It is similar to what Trap 17 has when a Moderator
    Edits a post and places a message in the post in the Box. I want to be able to have my Moderators
    have a box to place a message in and it say up top that they are the ones that Posted it. Thank you
    for any help you can offer with this. Jesse....
  18. Joomla Upgrade From Fantastico Script - (4)
    Hello, I have Joomla from Fantastico Script and to my I would like to make the upgrade from the
    version 1.03 to the version 1.04 by means of a patch that it upgrades it, How I Do for not to
    already lose the data already kept in my obsolete version 1.0.3?Thanks very much.See you soon....
  19. Hosting Credits Script Failing? - (6)
    QUOTE This notice is for hosted members, and is meant as a fair warning to let you know that we
    are using a script to validate all hosting credits. The script run once every hour and has three
    parameters. 1, it checks to see if hosting credits are below 0 and if below 0 the account is
    suspended. 2, it checks to see if an account has 3, it checks to see if your hosting credits is
    >= 4 (Greater than or equal to 4) hosting credits. A suspended account will be reinstated at that
    time and you will be able to access your cPanel again, ftp and web site should be back to...
  20. How To Erase A Fantastico Script¿ - (1)
    I installed xoop script from fantastico collection, but don´t like it, i want to erase but i don´t
    know. How to erase a xoop sript? thanks...
  21. Error Uploading Files From Joomla Script. - (1)
    i have seen the other post but i don´t understand very well, i have joomla in fantastico and when i
    want to upload file i see: Invalid checksum for file " Upload language - Upload Failed for
    example.i upload with the ftp integrated in joomla online and see this anunncement.How i do?i upload
    the files when i unzipped files and upload from C directory....
  22. Login Script Help - (9)
    My friend helped me create a login script. But there is a error that shows up on the page. I am able
    to connect to the database and login in and everything but theres an error on the page. CODE
    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started
    at /home/dynasty/public_html/New Folder/db_connect.php:9) in /home/dynasty/public_html/New
    Folder/check_login.php on line 13 Can someone tell me whats wrong. Im new to php and mysql. So
    please be gentle /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ...
  23. Guestbook (cgi-script) Problems - Do u know much bout chmod and cgi-cripts? (0)
    Hi! I'd like to make a guestbook with a cgi-script I found at Lissa Explains it All . There
    were instruction bout how to install this gbook: click here QUOTE Active Guestbook Unzip the
    file, you'll find 4 separate files: guestbook.cgi mail.gif url.gif readme.txt 1. Open
    guestbook.cgi in a plain text editor like notepad. Find out your path to perl from your Web host,
    and change the first line to reflect that. The default setting, #!/usr/bin/perl, usually works for
    most servers. If not, you can try #!/usr/local/bin/perl. Save your changes. 2. Create ...
  24. Java Script Problem - (8)
    hey..are java scripts allowed? cause i've been trying to put this script..it's like an
    advertisement.. but it will not allow me.. when i try to put it it gives me this error " These HTML
    Tags are not allowed? anyone have this problem or know how to fix it?...
  25. Mysql Script Not Supported? - (5)
    i put up a PHP and MYSQL site recently, which was hosted on tripod(loosers), where it used to work
    fine, i put i up here again, it says: CODE Warning: mysql_fetch_array(): supplied argument is
    not a valid MySQL result resource in /home/tariq/public_html/fsgr/script/orders.php on line 47
    what does this mean, is the PHP or MYSQL version up to date?? or is there somthing wrong with my
    coding, Please help Tariq...
  26. Problem With Some Script.. - (2)
    I tried to upload some php files with FTP... its SmartFTP client.. i cant upload all the files..
    it's just says error with files uploading.. i dont know how to solve the problem.. trying whole
    day for this.. help me out here.. /huh.gif' border='0' style='vertical-align:middle'
    alt='huh.gif' /> ...
  27. Login And Registration Script - One that's easy to do (3)
    As many know, my frustrations lately have been from one thing...trying to implement a login and
    registration part to my site. Welp, after browsing the net I found the tutorial that made it work
    for me. I did not get one error when I copied and pasted the codes...so for anyone who has had
    endless trouble implementing this feature into your website, click on the link below, it worked for
    me. You can also, on that website tutorial, browse through the comments below all of the codes,
    there is some addtional information that you can learn to enhance your login and regist...
  28. Php Script Help - (3)
    is there any good scrips for a tutorial like system and possibly with comments? I am kinda stuck
    until i can get someting going with that....
  29. Geeklog 1.3.9 Pre Installed Script Isn't Working - Preinstalled Scripts / Addon Scripts (0)
    hello, in the Preinstalled Scripts / Addon Scripts , in the cpanel, there is a script called
    Geeklog 1.3.9 that doesn't seem to be working fine. it says the installation was complete, but
    when i try to access the new page or admin interface, i get an error.. - when i try to access the
    new page, you can see it for yourself @ http://ket.trap17.com/geeklog/ - it just shows all the
    files under the /geeklog dir. - when i try to access admin interface, i get this error: CODE
    Fatal error: Call to undefined function: com_refresh() in /home/ket/public_html/geeklog/...
  30. My .randhtml script is not working! - can somebody help? (0)
    I use a Quote of the day feature in my site that is not working properly nowadays... I think the
    problem is in my cgi-bin file randhtml.cgi. Can someone send their file to me by email? Under:
    CODE file manager>public_html>cgi-bin>randhtml.cgi Thank you...



Looking for script, work, php



Searching Video's for script, work, php
See Also,
advertisement



Cant Get A Script To Work - PHP

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com



Creative Commons License