Jump to content

Problem with switch


wrathican

Recommended Posts

so ive got a little problem with a switch statement.

i get this error in my browser:

Parse error: syntax error, unexpected T_CASE in F:\wamp\www\Cycle Yorkshire\cms\course.php on line 98

 

line 98 is this:

case "delete":

 

this is the second case in the switch statement.

 

here is the complete code of my page:

<?php

include '../include/switch.inc';
include '../include/misc.inc';
include '../include/opendb.inc';
?>

<html><!-- InstanceBegin template="/Templates/CYcms.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<title>CycleYorkshire.co.uk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../cy.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><center>
<!-- ImageReady Slices (layout_concept copy.jpg) -->

<table id="Table_01" width="1000" height="624" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="206" colspan="2"><img src="../images/layout_concept-copy_01.jpg" width="305" height="206" alt=""></td>
    <td colspan="3"><img src="../images/layout_concept-copy_02.jpg" width="695" height="206" alt=""></td>
  </tr>
  <tr>
    <td width="100" rowspan="2"><img src="../images/layout_concept-copy_03.jpg" width="100" height="418" alt=""></td>
    <td width="205" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="205" height="336" valign="top"><?php include '../include/navicms.inc' ?></td>
    </tr>
      <tr>
        <td height="45" valign="top"><img src="../images/layout_concept-copy_22.jpg" width="205" height="45" alt=""></td>
    </tr>
      <tr>
        <td height="12" valign="top"><a href="http://www.pixelgloss.co.uk" target="_blank"><img src="../images/layout_concept-copy_23.jpg" alt="" width="205" height="12" border="0"></a></td>
    </tr>
      <tr>
        <td height="25" valign="top"><img src="../images/layout_concept-copy_24.jpg" width="205" height="25" alt=""></td>
    </tr>
    </table>
    </td>
    <td height="38" colspan="3"><img src="../images/layout_concept-copy_05.jpg" width="695" height="38" alt=""></td>
  </tr>
  
  <tr>
    <td width="11" height="380"><img src="../images/layout_concept-copy_07.gif" width="11" height="380" alt=""></td>
    <td width="585" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable--><!-- InstanceBeginEditable name="content" -->
      <tr>
        <td width="585" height="19" valign="top"><h1>Welcome to the Content Management System</h1></td>
      </tr>
      <tr>
        <td height="361" valign="top"><p>
	  <?php
	  
	  switch($_GET['func'])
	  {
	  case "edit":
	  
	  $id = $_GET['id'];
	  
	  $query = "SELECT * FROM cy_course WHERE cy_id='".$id."'";
	  
	  $result = mysql_query($query);
	  
	  while ($row = mysql_fetch_row($result))
	  {
	  $courseid = $row[0];
	  $coursetitle = $row[1];
	  $coursedescription = $row[2];
	  $courseprice = $row[3];
	  $courselevel = $row[4];
	  $courselocation = $row[5];
	  
	  ?>
	  <form name="edit course" method="post" action="processcourse.php">
   Title:<br>
  <input name="title" type="text" value="<?php echo $coursetitle; ?>">
  <br>
   Description:<br>
  <textarea name="description" cols="75" rows="10"><?php echo $coursedescription; ?></textarea>
  <br>
  Price:<br>
  <input name="price" type="text" value="<?php echo $courseprice; ?>">
  <br>
  Level:<br>
  <input name="level" type="text" value="<?php echo $courselevel; ?>">
  <br>
  Location:<br>
  <input name="location" type="text" value="<?php echo $courselocation; ?>">
  <br>
  <input name="id" type="hidden" value="<?php echo $courseid; ?>">
  <input type="submit" name="Submit" value="Submit">
  <input type="reset" name="Submit2" value="Reset">
  </form>
  <?php
	  break; 
	  
	  case "delete":
	  
	  $id = $_GET['id'];
	  
	  $query = "DELETE FROM cy_course where cy_id='".$id."'";
	  
	  mysql_query = ($query);
	  
	  echo "Thank you. The course you selected has been deleted.";
	  
	  break;
	  
	  case "add":
	  
	  ?>
	  
	  		  <form name="edit course" method="post" action="processcourse.php">
   Title:<br>
  <input name="title" type="text">
  <br>
   Description:<br>
  <textarea name="description" cols="75" rows="10"></textarea>
  <br>
  Price:<br>
  <input name="price" type="text">
  <br>
  Level:<br>
  <input name="level" type="text" >
  <br>
  Location:<br>
  <input name="location" type="text">
  <br>
  <input type="submit" name="Submit" value="Submit">
  <input type="reset" name="Submit2" value="Reset">
  </form>
  
	  <?php
	  
	  default:
	  
	  echo 'There has been an error, please go <a href="cms.php">back</a> and try again.';
	  
	  ?>
	  </td>
      </tr>
      <!-- InstanceEndEditable -->
    </table></td>
    <td width="99" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="99" height="0"></td>
        </tr>
      <tr>
        <td height="380" valign="top"><!--DWLayoutEmptyCell--> </td>
    </table></td>
  </tr>
</table>

<!-- End ImageReady Slices -->
</body>
<!-- InstanceEnd --></html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.