Wow Web Designs Forums Home

Search
   
Members

Calendar

Help

Home
Search by username
Not logged in - Login | Register 
Wow Web Designs Forums > Scripting > PHP > homepage.php?page= i need help :D


homepage.php?page= i need help :D
 Moderated by: Aycan  

New Topic

Reply

Print
AuthorPost
qurb
Member
 

Joined: Wed Jun 21st, 2006
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Thu Jun 22nd, 2006 12:07 am

Quote

Reply
i need some help to find out hoe i can get my nav bar to work.....

 

ok i have a homepage.... in php

and i have a nav bar in that and one of the links is http://example.com/homepage.php?page=community

and now i dont know how to get that to open my page

http://example.com/community.php

how do i do that?

joshimitsu
Member


Joined: Wed Jun 8th, 2005
Location: England
Posts: 305
Status:  Offline
Mana: 
 Posted: Thu Jun 22nd, 2006 05:19 pm

Quote

Reply
<?php
        $site
= $_GET['page'];
        
switch($site) {
        case
'community':
        
include "community.php";
        
break;
        
default
     ?>

pixle_dude
Member


Joined: Wed Jun 14th, 2006
Location: Sydeny, Australia
Posts: 152
Status:  Offline
Mana: 
 Posted: Fri Sep 22nd, 2006 01:14 pm

Quote

Reply
joshimitsu wrote: <?php
        $site
= $_GET['page'];
        
switch($site) {
        case
'community':
        
include "community.php";
        
break;
        
default
     ?>

Hi i had a little error when i ran the script...

Parse error: syntax error, unexpected $end in /home/m/mecoke/www/test/page/index.php on line 22

Explain?
Oh dose this have to be in the header of the PHP document

kyle
Member
 

Joined: Thu Jul 20th, 2006
Location: Canada
Posts: 4
Status:  Offline
Mana: 
 Posted: Fri Sep 29th, 2006 01:06 pm

Quote

Reply
Well.. thats really .. confusing. Heres a REALLY simple one.

 

<?
// This is a little bit of PHP
$p = $_GET['page'];
if ($p) {
include($p.".php");
}else{
include("news.php"); //Pur Page You Want To Show Up If There Is No $p
}
?>


Thanks to my friend, he made this code. Amazing job Logan!

Poseted by me but all credit goes to Logan.

azoundria
Member
 

Joined: Thu Sep 28th, 2006
Location:  
Posts: 20
Status:  Offline
Mana: 
 Posted: Fri Sep 29th, 2006 07:05 pm

Quote

Reply
Sinc you might want to use a form to submit variables to the page, it's best to use $_REQUEST to get from both GET and POST.

$p = $_REQUEST['page'];

kyle
Member
 

Joined: Thu Jul 20th, 2006
Location: Canada
Posts: 4
Status:  Offline
Mana: 
 Posted: Fri Sep 29th, 2006 07:08 pm

Quote

Reply
It works.. im not compaining :D

pixle_dude
Member


Joined: Wed Jun 14th, 2006
Location: Sydeny, Australia
Posts: 152
Status:  Offline
Mana: 
 Posted: Sat Sep 30th, 2006 06:18 am

Quote

Reply
kyle wrote: Well.. thats really .. confusing. Heres a REALLY simple one.

 

<?
// This is a little bit of PHP
$p = $_GET['page'];
if ($p) {
include($p.".php");
}else{
include("news.php"); //Pur Page You Want To Show Up If There Is No $p
}
?>


Thanks to my friend, he made this code. Amazing job Logan!

Poseted by me but all credit goes to Logan.

I don't get this one is where it says : include($p.".php");
".php" is ment to be your page right?

GemX
Member
 

Joined: Fri May 25th, 2007
Location:  
Posts: 9
Status:  Offline
Mana: 
 Posted: Fri May 25th, 2007 09:11 pm

Quote

Reply
Two types

1.
<?php
    $getMe = $_GET['page'];

if(isset($getMe))
{
    if($getMe == 'comunity')
    {
       include('comunity.php');
    }
}
else
{
    die('Value for page is blank man! :)');
}
   
?>


2. example if url query is = 2  ?page=community, script will load comunity.php file
    if ?page=somefile, script will load somefile.php if exists if not it will die and tell you that this file cannot be included bcoz it doesnt exist. to disable error reporting check commented line at start of php code
<?php
// error_reporting(0);

$page = $_GET['page'];

if($page)
{
    include($page.'.php'));
}
else
{
    die('Value for page is blank man! :)');
}

?>


Or you can use switch like entered above.

jkewlo
Member
 

Joined: Mon Sep 15th, 2003
Location: Farmville, Virginia USA
Posts: 5
Status:  Offline
Mana: 
 Posted: Sun Nov 11th, 2007 11:10 pm

Quote

Reply
hey this is what im trying to do


<a href="<? echo "$self?page=addnews" ?>">ADD NEWS</a><br />
                <a href="<? echo "$self?page=modify" ?>">MODIFY NEWS</a><br />
                <a href="<? echo "$self?page=delete" ?>">DELETE NEWS</a><br />
                <a href="<? echo "$self?page=editban" ?>">EDIT/BAN USERS</a>


are my links as u can see i have set page to page= and there names

now the code that u gave him below.

how do i get it to work

do i make a file with

addnews
modify
delete
editban
?????????


what do i do please someone help me!

TomWhitney
Member


Joined: Fri Dec 30th, 2005
Location: Phoenix, Arizona USA
Posts: 99
Status:  Offline
Mana: 
 Posted: Tue Nov 13th, 2007 08:29 pm

Quote

Reply
If you are using this line

include($p.".php");


Then you need to create these files

addnews.php
modify.php
delete.php
editban.php

The contents of the included file will be treated as if you concatenated it to the file with the include statement. Any PHP in the included file will be run.

Phoenix Arizona Computer Consultants

jkewlo
Member
 

Joined: Mon Sep 15th, 2003
Location: Farmville, Virginia USA
Posts: 5
Status:  Offline
Mana: 
 Posted: Wed Nov 14th, 2007 02:11 am

Quote

Reply
ahhh ok. so the includes dont need the <html> <body> etc... cuz it will cause it to multiply the page a thousand times as i see so it will need just the content of the page and nothing more?


and the main page would be admin.php and then it would call

admin.php?page=addnews etc... ok i gotcha thanks!

resource004
Member
 

Joined: Fri Apr 4th, 2008
Location:  
Posts: 65
Status:  Offline
Mana: 
 Posted: Thu Apr 24th, 2008 07:56 am

Quote

Reply
Hi Friends,
Do you have any problem in web designing and development or do you want any kind of help in PHP/MYSQL or you need reliable and cheap web hosting or have any problem in E-commerce solutions then go to this site http://www.pakandu.com/contactus.php ,
It is a company of web designing and development and it have a great web designers, developers and Programmers.
When I got in any problem of web designing /development and Programming  or I need reliable web hosting or facing any problem in E-commerce Solutions then I just go to this site and ask them the solution of my problem and they always provide me best solution for my problem.
So do you have any above problems then contact them without any hesitation.
 
Regards,
 
Resource


 Current time is 07:52 pm




Powered by WowBB 1.7 - Copyright © 2003-2006 Aycan Gulez
Page processed in 0.2401 seconds (8% database + 92% PHP). 18 queries executed.