[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 05-28-2006, 03:40 PM   · #1
edmarriner
NamePros Regular
 
edmarriner's Avatar
 
Name: Edward Marriner
Location: England :D
Trader Rating: (22)
Join Date: Apr 2005
Posts: 838
NP$: 51.85 (Donate)
edmarriner is a jewel in the roughedmarriner is a jewel in the roughedmarriner is a jewel in the rough
Quick 5 min thing. getting blank page

Hi,

Im getting a blank page with no errors on.

The php code im using is this and i cant see anythink wrong, any deas, prob me just being stupid and missing out somthing simple.

PHP Code:
<?php
  
if(
    
$_POST['do'] == "" or $_GET['do'] == ""){
        
$_GET['do'] == "home";
}
if(
    
$_POST['do'] == "search" or $_GET['dosearch'] == "yes"){
        
$subaction = "search"; $dosearch = "yes"; include("./search.php");
}elseif(
    
$_GET['do'] == "TV_news"){
        
$category = "1"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "TV_sport"){
        
$category = "2"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "TV_kids"){
        
$category = "3"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "TV_music"){
        
$category = "4"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "TV_moives"){
        
$category = "5"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "TV_general"){
        
$category = "6"; $template = "tv"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "home"){
        
$category = "100";  $template = "content"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "contact"){
        
$category = "101";  $template = "content"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "help"){
        
$category = "103";  $template = "content"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "submit"){
        
$category = "104";  $template = "content"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "tv"){
        
$category = "105";  $template = "content"; include("./show_news.php");
}elseif(
    
$_GET['do'] == "a1d9m9i2n"){
         echo
"welcome back admin";
}else(
         echo
"Error, do is empty or is somthing its not ment to be, do = '$do' ";
}
?>


Any help will be a great help.

Thanks,

-ed


Please register or log-in into NamePros to hide ads
__________________
Leeds united football club


edmarriner is offline   Reply With Quote
Old 05-28-2006, 03:55 PM   · #2
iNod
Eating Pie
 
iNod's Avatar
 
Name: Steve
Location: Canada
Trader Rating: (66)
Join Date: Nov 2004
Posts: 2,284
NP$: 91.30 (Donate)
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Hello,

First I would recommand you do this.

Remove all those if's and change them to switch and case

Example of switch and case
PHP Code:
switch ($i) {
case
0:
   echo
"i equals 0";
   break;
case
1:
   echo
"i equals 1";
   break;
case
2:
   echo
"i equals 2";
   break;
default:
   echo
"i is not equal to 0, 1 or 2";
}

(Copied from php.net :P)

Anyways.. I would recommand you use that instead of a bunch of if's. Give that a try.

- Steve
__________________
RegisterDub.com - 200th Customer Milestone
ZuneParts.net - International Zune Parts and Accessories
FeaturedFont.com - One Top Free Font a Day!
iNod is offline   Reply With Quote
Old 05-28-2006, 04:30 PM   · #3
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Yes, agreed with iNod. Uses switch()'s man! And since I'm in a good mood, for once, something like below:

PHP Code:
<?php

if ($_POST['do'] == '' OR $_GET['do'] == '')
{
    
$_GET['do'] == 'home';
}
else if (
$_POST['do'] == 'search' or $_GET['dosearch'] == 'yes')
{
    
$subaction = 'search';
    
$dosearch = 'yes';
    include(
'./search.php');
}
else
{
    switch (
$_GET['do'])
    {
        case
'TV_news':
            
$category = '1';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'TV_sport':
            
$category = '2';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'TV_kids':
            
$category = '3';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'TV_music':
            
$category = '4';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'TV_moives':
            
$category = '5';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'TV_general':
            
$category = '6';
            
$template = 'tv';
            include(
'./show_news.php');
            break;
        case
'home':
            
$category = '100';
            
$template = 'content';
            include(
'./show_news.php');
            break;
        case
'contact':
            
$category = '101';
            
$template = 'content';
            include(
'./show_news.php');
            break;
        case
'help':
            
$category = '103';
            
$template = 'content';
            include(
'./show_news.php');
            break;
        case
'submit':
            
$category = '104';
            
$template = 'content';
            include(
'./show_news.php');
            break;
        case
'tv':
            
$category = '105';
            
$template = 'content';
            include(
'./show_news.php');
            break;
        case
'a1d9m9i2n':
            echo
'Welcome back admin';
            break;
        default:
            
$category = '100';
            
$template = 'content';
            include(
'./show_news.php');
            break;
    }
}

?>
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Old 05-28-2006, 05:48 PM   · #4
nasaboy007
NamePros Regular
 
Location: mysitememberships.com
Trader Rating: (32)
Join Date: Jul 2005
Posts: 925
NP$: 4800.90 (Donate)
nasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to behold
well the reason ur getting a blank page is because ur error "else" case is wrong. you have this:

PHP Code:
}else(
         echo
"Error, do is empty or is somthing its not ment to be, do = '$do' ";
}


it should be this:

PHP Code:
}else{
         echo(
"Error, do is empty or is somthing its not ment to be, do = " . $do);
}


notice the curly bracket open after the else rather than the open parenthesis. also, you have never define the variable $do. if u want it to echo $_GET['do'], then either write that out or put somewhere before in that code $do = $_GET['do'].

also, in ur first couple of if statements, you have:

PHP Code:
$_POST['do'] == "" or $_GET['do'] == ""


im not sure, but i dont know if u can use the word "or". i wud suggest using || (thats BAR BAR, shift+slashaboveenter) instead of or (just like && is used for and).

change all that and see if it works.
__________________
nasaboy007 is offline   Reply With Quote
Old 05-29-2006, 02:56 AM   · #5
edmarriner
NamePros Regular
 
edmarriner's Avatar
 
Name: Edward Marriner
Location: England :D
Trader Rating: (22)
Join Date: Apr 2005
Posts: 838
NP$: 51.85 (Donate)
edmarriner is a jewel in the roughedmarriner is a jewel in the roughedmarriner is a jewel in the rough
We're glad that you're fond of this member, but please give some rep points to some other members before giving it to SecondVersion again.

We're glad that you're fond of this member, but please give some rep points to some other members before giving it to nasaboy007 again.

Ill send over some np because i cant give you any rep.
__________________
Leeds united football club


edmarriner is offline   Reply With Quote
Old 05-29-2006, 07:31 PM   · #6
nasaboy007
NamePros Regular
 
Location: mysitememberships.com
Trader Rating: (32)
Join Date: Jul 2005
Posts: 925
NP$: 4800.90 (Donate)
nasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to beholdnasaboy007 is a splendid one to behold
lol NP$ received thnx man!

glad to be of service!
__________________
nasaboy007 is offline   Reply With Quote
Old 05-30-2006, 09:47 AM   · #7
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
No problem. And thanks for the NP$, although it wasn't needed

Eric
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Old 05-30-2006, 10:25 AM   · #8
PoorDoggie
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Name: Tom
Location: UK
Trader Rating: (36)
Join Date: Jan 2005
Posts: 2,390
NP$: 300.50 (Donate)
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
Originally Posted by nasaboy007
well the reason ur getting a blank page is because ur error "else" case is wrong. you have this:

PHP Code:
}else(
         echo
"Error, do is empty or is somthing its not ment to be, do = '$do' ";
}


it should be this:

PHP Code:
}else{
         echo(
"Error, do is empty or is somthing its not ment to be, do = " . $do);
}



Those shouldn't be needed, just putting a space inbetween the "echo" and the " "..." " should be necessary and also as long as there are double quotes " " " round something then you can just echo "$do" in the middle of a string.

What I can see is that you never set the variable "$do" to mean anything. Put this at the start of your code:

PHP Code:
if(isset($_POST['do']) || isset($_GET['do'])){
  
$do = (isset($_POST['do'])) ? $_POST['do'] : $_GET['do'];
}
else{
  echo
"No $do variable is set";
}


Now, every instance of $_GET['do'] and $_POST['do'] can be exchanged for $do.

Quote:
also, in ur first couple of if statements, you have:

PHP Code:
$_POST['do'] == "" or $_GET['do'] == ""


im not sure, but i dont know if u can use the word "or". i wud suggest using || (thats BAR BAR, shift+slashaboveenter) instead of or (just like && is used for and).



I know that "OR" works, and therefore I think that "or" would work, but it is good practice to use "||" instead (don't ask me why, I just like it that way! )


Good luck with your code!
PoorDoggie is offline   Reply With Quote
Old 05-30-2006, 11:03 AM   · #9
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Using either OR or || is the same. Just as AND or &&.
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Buy Flash Arcade Game Script Hunting Moon EscrowDNS
Advertise your business at NamePros
All times are GMT -7. The time now is 10:09 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0