Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Hi guys again, having some issues with this form I am currenty working on I have checked and double checked and I am still getting this message "
    Parse error: syntax error, unexpected T_CASE in C:\Program Files\xampp\htdocs\www\form4.php on line 51"
    below is the rather lengthy script

    PHP Code:
    <?php
    function debugDispay()
    {
    ?>
    <pre>
    $_POST
    <?php
    print_r
    ($_POST);
    ?>
    $_GET
    <?php
    print_r
    ($_GET);
    ?>
    </pre>
    <?php
    }
    if (!isset(
    $_GET["step"])) 
    {
    require (
    "startform.php");
    }
    else
    {
    //Switch on search add form
    switch ($_GET["step"])
    {
    //Search Add Form
    case "1":
    $type explode(":"$_POST["type"]);
    if (
    $_POST["Submit"] == "Add")
    {
    require 
    $_POST["Submit"] . $type[0] . " .php";

    else 
    {
    if (
    $_POST["type"] == "Movie:Movie" &&
    $_POST["MovieType"] == "")
    {
    header("Location:form4.php");
    }
    ?>
    <h1>Search Results</h1>
    <p>You are looking for a <?php echo $type[1]; ?> named &nbsp; 
    <?php echo $_POST["Name"]; ?></p>
     <?php
     
    if ($_POST["Debug"] == "on")
     {
     
    debugDisplay();
     }
     break;
     
    //Add Summary
    case "2"//Here is line 51   
    $type explode(":"$_POST["type"]);
     
    ?>
     <h1>New <?php $type[1]; ?> : <?php echo $_POST["Name"]; ?></h1>
     <?php
     
    switch ($type[0])
     {
     case 
    "Movie":
     
    ?>
     <p>Released in <?php $_POST["MovieYear"]; ?></p>
     <p><?php echo n12br(stripslashes($_POST["Desc"])); ?></p>
     <?php
     
    break;
     default:
     
    ?>
     <h2>Quick Bio</h2>
     <p><?php echo n12br(stripslashes($_POST["Bio"])); ?></p>
     <?php
     
    break;
     }
     break;
     
    //Starting Form
     
    default:
     require (
    "startform.php");
     break;
     }
     }
     
    ?>
    Please help

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I'm relatively certain you forgot to close the else inside the first case.

    One word: INDENTATION!! Use indentation to make the blocks in your code visually obvious, otherwise you'll never be able to figure out what's wrong structurally. Indent after if statements, switches, cases, elses, else ifs, fors, whiles, etc. Indent, indent, indent. People don't just do it for fun, they do it because it's one of the most useful things you can possibly do for readability of code.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:45 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com