Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP if function not working
Old 12-06-2008, 04:21 AM PHP if function not working
Skilled Talker

Posts: 90
Trades: 0
At the moment I have this script
PHP Code:
    if (isset ($type == flash)) {
    include (
"Scripts/flashembed.php")}
    elseif (
$type == html) {
    include (
"Scripts/htmlembed.php")}
    else {echo(
$errmsg)} 
At the moment it is coming up with:

Parse error: parse error, unexpected T_IF in /home/www/xuroqtest.freehostia.com/preview.php on line 23

I have attached the whole file if it is needed:
php problem.zip
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-06-2008, 04:42 AM Re: PHP if function not working
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
because, if "flash" and "html" are not constants, PHP don't know what they are.
Strings are always delimited by " or '
PHP Code:
if (isset ($type == 'flash')) {
    include (
"Scripts/flashembed.php")}
elseif (
$type == 'html') {
    include (
"Scripts/htmlembed.php")}
else {echo(
$errmsg)} 
</span></span>
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-06-2008, 06:05 AM Re: PHP if function not working
Skilled Talker

Posts: 90
Trades: 0
i am still getting the same error

Parse error: parse error, unexpected T_IF in /home/www/xuroqtest.freehostia.com/preview.php on line 23
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
Old 12-06-2008, 06:26 AM Re: PHP if function not working
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
looking at the code above (and the missing semi-colons ";").

I'd suggest a missing semi-colon in the previous line.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-06-2008, 06:38 AM Re: PHP if function not working
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Oh, right.
I didn't even noticed that the echo was missing the ;.

And effectively, the message don't say there is a problem in the if, but that there was something else expected before the if.
Quote:
parse error, unexpected T_IF
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-06-2008, 07:51 AM Re: PHP if function not working
Skilled Talker

Posts: 90
Trades: 0
I'm still getting the same error

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include("Scripts/arrays.php"?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title?> - Xuroq Flash</title>
<meta name="title" content="<?php echo $title?> - Xuroq Flash" />
<meta name="description" content="<?php echo $content ?>" />
<meta name="robots" content="all" />
<link rel="shortcut icon" href="pictures/favicon1ico" />
<link rel="stylesheet" type="text/css" href="Scripts/main.css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<body>

<div id="maincontainer">

<?php include("Scripts/header.php"); ?>

<div id="leftcolumn">

<?php
    
if (isset ($type == "flash")) {
    include (
"Scripts/flashembed.php")}
    elseif (
$type == "html") {
    include (
"Scripts/htmlembed.php")}
    else {echo;(
$errmsg)}
?>

</div>

<div id="rightcolumn">
  <table width="370" height="423" border="0">
    <tr>
      <td align="left" height="158" valign="top"><b style="font-size:15px">
      <?php echo $title?></b><br /><br />
      <p><b>Size: </b><?php echo $filesize ?></p>
      <p><b>Date Added: </b><?php echo $dateadded ?></p>
      </td>
    </tr>
    <tr>
      <td height="88" align="center" valign="top"><a href="<?php echo $zipname?>" ><img src="pictures/download_icon.png" border="0px" /></a></td>
    </tr>
    <tr>
      <td height="169" align="center" valign="bottom"><?php include ("Scripts/previewpageads.php"?></td>
    </tr>
  </table>
  


</div>
</div>

<?php include ("Scripts/footer.php"?>

</body>
</html>
I only know very basic PHP so it may be something obvious
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
Old 12-06-2008, 08:40 AM Re: PHP if function not working
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
<meta name="description" content="<?php echo $content ?>" />
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-06-2008, 11:24 AM Re: PHP if function not working
Ultra Talker

Posts: 483
Trades: 0
Or possible even a problem in the included "Scripts/header.php" file?
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 12-06-2008, 12:28 PM Re: PHP if function not working
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
This should be working.
I've found somewhat 10 possible errors regarding semicolons.

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include("Scripts/arrays.php"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title?> - Xuroq Flash</title>
<meta name="title" content="<?php echo $title?> - Xuroq Flash" />
<meta name="description" content="<?php echo $content?>" />
<meta name="robots" content="all" />
<link rel="shortcut icon" href="pictures/favicon1ico" />
<link rel="stylesheet" type="text/css" href="Scripts/main.css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<body>

<div id="maincontainer">

<?php include("Scripts/header.php"); ?>

<div id="leftcolumn">

<?php
    
if (isset ($type == "flash")) {
    include (
"Scripts/flashembed.php");}
    elseif (
$type == "html") {
    include (
"Scripts/htmlembed.php");}
    else {echo(
$errmsg);}
?>

</div>

<div id="rightcolumn">
  <table width="370" height="423" border="0">
    <tr>
      <td align="left" height="158" valign="top"><b style="font-size:15px">
      <?php echo $title?></b><br /><br />
      <p><b>Size: </b><?php echo $filesize?></p>
      <p><b>Date Added: </b><?php echo $dateadded?></p>
      </td>
    </tr>
    <tr>
      <td height="88" align="center" valign="top"><a href="<?php echo $zipname?>" ><img src="pictures/download_icon.png" border="0px" /></a></td>
    </tr>
    <tr>
[b]      <td height="169" align="center" valign="bottom"><?php include ("Scripts/previewpageads.php"); ?></td>[/b]
    </tr>
  </table>
  


</div>
</div>

<?php include ("Scripts/footer.php"); ?>

</body>
</html>
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 12-06-2008, 05:25 PM Re: PHP if function not working
Skilled Talker

Posts: 90
Trades: 0
thanks all seems to work now
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
Old 12-06-2008, 05:38 PM Re: PHP if function not working
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Is your favicon showing up?

HTML Code:
<link rel="shortcut icon" href="pictures/favicon1ico" />
to
<link rel="shortcut icon" href="pictures/favicon1.ico" />
</span></span>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Reply     « Reply to PHP if function not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33469 seconds with 13 queries