This is my code - which displays different articles and produces articles as http://www.mysite.com/testpage.php?test=1

<html>
<body>
<?
$i=$_GET['day'];
switch ($i) {
case 1:
    include("2.php");
    break;
case 2:
    include("3.php");
    break;
case 3:
    include("4.php");
    break;
default:
    //echo "page not found!!!!";
}
?>
<!--
<? if($_GET['day']==1){ ?>
 <?php include("2.php") ?>
<? }else if($_GET['day']==2){ ?>
 <?php include("3.php") ?>
<? }else if($_GET['day']==3){ ?>
 <?php include("4.php") ?>
 <? }else if($_GET['day']==4){ ?>
 <?php include("5.php") ?>
 <? }else if($_GET['day']==5){ ?>
 <?php include("6.php") ?>
 <? }else if($_GET['day']==6){ ?>
 <?php include("7.php") ?>
 <? }else if($_GET['day']==5){ ?>
 <?php include("1.php") ?>
<? }else if(!is_numeric($_GET['day']) || $_GET['day']<1){ ?>
<!--invalid id (or page not found)--> -->
<?php
$d=date("D");
switch ($d)
{
case "Mon":
    include("2.php");
  //echo "Today is Monday";
  break;
case "Tue":
    include("3.php");
  //echo "Today is Tuesday";
  break;
case "Wed":
    include("4.php");
  //echo "Today is Wednesday";
  break;
case "Thu":
    include("5.php");
  //echo "Today is Thursday";
  break;
case "Fri":
    include("6.php");
  //echo "Today is Friday";
  break;
case "Sat":
    include("7.php");
  //echo "Today is Saturday";
  break;
case "Sun":
    include("1.php");
  //echo "Today is Sunday";
  break;
default:
  //echo "Wonder which day is this ?";
}
?>
</body>
</html>

However, I get this error:
Parse error: syntax error, unexpected $end in C:\www\vhosts\mylocalhostsite\testing.php on line 73

I have tried for myself to fix it, but keep getting the $end error repeatedly, anyone else done this type of PHP and managed to find a fix for this?

Recommended Answers

All 4 Replies

You most likely forget a closing }.

else if(!is_numeric($_GET) || $_GET<1){ ?>

no correspond }

Why so many opening and closing tags for PHP?

Get rid of all the unneeded tags, indent your code and missing braces will be more easy to spot.

put the break in the default and forgot the closing brace of last else if()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.