SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    what ever i type in this file in HTML ITS SHWOING ERROR

    i dont know what happened after typing doctype in line 52 its start showing error on almost each and every line although code are correct but it still showing error, in line 53 to 63, and in line 69. although code are correct than why its showing mistake i changed the color of the line to where its showing error

    thanks


    Code PHP:
    1.<?php
    2.  session_start ();
    3. include ("include/connect.php");
    4. include ("include/html_codes.php");
     
    5. $x=$_GET ['x'];
    6. function createMessage ($x) {
    7. if (is_numeric ($x)) {
    8.    switch ($x) {
     
    9. case 0:
    10. $message= "your account is now active, you may now <a href=\"login.php\"Log In!</a>
    11. break;
     
    12. case 1:
    13. $message='thank you for registering! a confermatioin e mail has been sent to your 
    14    email account please clkick on the antivation link to activate our account.';
    15. break;
    16. case 2:
     
    17. $message ='that e mail adress or username has already been registered.';
    18   break;
     
    19   case 3:
    20   $message= 'sorry, that item has already been traded!';
    21   break;
     
    22  case4:
    23  $message = 'item successfully updated!';
    24 break;
     
    25    case 5:
    26        $message = 'item successfully deleted';
    27        break;
     
    28    case 6:
    29        $message ='message has been sent';
    30        break;
     
    31    case 7: 
    32        $message = 'thank you for leaving feedback';
    33       break;
     
    33   case 8:
    34       $message = 'item added successfully';
    35       break;
     
    36   case 9:
    37       $message ='that is not your item';
    38    break;
     
    39    }
     
    40    echo $message;
    41 endfor;
     
    42            break;
    43
    44        default:
    45            break;
    46    }
    47. }
    48.
    49.
    50. ?>
    51.    
     
    52. <!DOCTYPE html>
    [COLOR=#000080]53. <html lang ="en">
    54. <head>
    55. <title>Prompt </title>
    56. <link rel="stylesheet" href="main.css">
    57. <link rel="stylesheet" href="prompt.php">
    58. </head>
     
    59. <body>
    60    <div id="wrapper>"
    61         <?php headerAndSearchCode ();?>
    62         <div id="outer">
     
    63             <div id="inner">[/COLOR]
     
    64 <?php createMessage ($x); ?>
    65                 </div>
    66         <?php footercode ();?>
    67. </div>
     
    68. </body>
    [COLOR=#0000CD][COLOR=#0000CD]69. </html>[/COLOR][/COLOR]
    Last edited by Dark Tranquility; Jun 4, 2012 at 03:21.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,176
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Do you have a live link? That would make it easier to see what's going on.

  3. #3
    The Mind's I ® silver trophy Dark Tranquility's Avatar
    Join Date
    Sep 2003
    Location
    KSA - UAE
    Posts
    9,457
    Mentioned
    8 Post(s)
    Tagged
    1 Thread(s)
    Looks like a PHP issue!
    Moved to the right forum!

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    The coloring in your post should give you a clue. (You've forgotten to close your string in Case 0)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  5. #5
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what link? sorry i did not understand, thanks

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,176
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by arifsuhail View Post
    what link? sorry i did not understand, thanks
    Look at the code coloring in line 9: it's yellow, unlike the lines below. StarLion is saying you need to add closing quotes to the message in line 10.

  7. #7
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    The coloring in your post should give you a clue. (You've forgotten to close your string in Case 0)
    now i closed the my first case 0: on line 10, but now its showing the error

    on line 41. the line is ... endfor; and the error is Parse error: syntax error, unexpected T_ENDFOR, thanks,, and more things how can change my post,, like now i close my line case 0: on line 10, after you mentioned, but in here i dont know how to change it, i want to change it,

  8. #8
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks i changed it already, but now its showing me the error on line 41.. and the line is endfor: and the error is Parse error: syntax error, unexpected T_ENDFOR, thanks and can i ask you how can i get the clue from coloring of the line, yah you are right, the line 9 is yellow. can you explain please

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,176
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Can you show the code you now have?

  10. #10
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is my new code and the error is on line 41 and the error is Parse error: syntax error, unexpected T_ENDFOR,

    and one more thing i was able to edit my post, but can you tell me how can i edit my orignal thread, thanks

    1.<?php
    2. session_start ();
    3. include ("include/connect.php");
    4. include ("include/html_codes.php");

    5. $x=$_GET ['x'];
    6. function createMessage ($x) {
    7. if (is_numeric ($x)) {
    8. switch ($x) {

    9. case 0:
    10. $message= 'your account is now active, you may now <a href=\"login.php\"Log In!</a>'
    11. break;

    12. case 1:
    13. $message='thank you for registering! a confermatioin e mail has been sent to your
    14 email account please clkick on the antivation link to activate our account.';
    15. break;
    16. case 2:

    17. $message ='that e mail adress or username has already been registered.';
    18 break;

    19 case 3:
    20 $message= 'sorry, that item has already been traded!';
    21 break;

    22 case4:
    23 $message = 'item successfully updated!';
    24 break;

    25 case 5:
    26 $message = 'item successfully deleted';
    27 break;

    28 case 6:
    29 $message ='message has been sent';
    30 break;

    31 case 7:
    32 $message = 'thank you for leaving feedback';
    33 break;

    33 case 8:
    34 $message = 'item added successfully';
    35 break;

    36 case 9:
    37 $message ='that is not your item';
    38 break;

    39 }

    40 echo $message;
    41 endfor; (in this line it is showing the error and the error is Parse error: syntax error, unexpected T_ENDFOR)

    42 break;
    43
    44 default:
    45 break;
    46 }
    47. }
    48.
    49.
    50. ?>
    51.

    52. <!DOCTYPE html>
    53. <html lang ="en">
    54. <head>
    55. <title>Prompt </title>
    56. <link rel="stylesheet" href="main.css">
    57. <link rel="stylesheet" href="prompt.php">
    58. </head>

    59. <body>
    60 <div id="wrapper>"
    61 <?php headerAndSearchCode ();?>
    62 <div id="outer">

    63 <div id="inner">


    64 <?php createMessage ($x); ?>
    65 </div>
    66 <?php footercode ();?>
    67. </div>

    68. </body>
    69. </html>
    Last edited by arifsuhail; Jun 4, 2012 at 22:51. Reason: made a mistake

  11. #11
    SitePoint Enthusiast scout1idf's Avatar
    Join Date
    Nov 2009
    Location
    Ohio
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I reformatted your last posted code so it was easier for me to read.

    I found you had "case4:" instead of "case 4:"

    I don't know if that will fix your problem or not, but it can't hurt. Also, you were missing your closing </div> for the wrapper...

    PHP Code:
    <?php
    session_start 
    ();
    include (
    "include/connect.php");
    include (
    "include/html_codes.php");

    $x=$_GET ['x'];
    function 
    createMessage ($x) {
         if (
    is_numeric ($x)) {
              switch (
    $x) {

                   case 
    0:
                        
    $message'your account is now active, you may now <a href=\"login.php\"Log In!</a>'
                        
    break;

                   case 
    1:
                        
    $message='thank you for registering! a confermatioin e mail has been sent to your email account please clkick on the antivation link to activate our account.';
                        break;

                   case 
    2:
                        
    $message ='that e mail adress or username has already been registered.';
                        break;

                   case 
    3:
                        
    $message'sorry, that item has already been traded!';
                        break;

                   case 
    4:
                        
    $message 'item successfully updated!';
                        break;

                   case 
    5:
                        
    $message 'item successfully deleted';
                        break;

                   case 
    6:
                        
    $message ='message has been sent';
                        break;

                   case 
    7:
                        
    $message 'thank you for leaving feedback';
                        break;

                   case 
    8:
                        
    $message 'item added successfully';
                        break;

                   case 
    9:
                        
    $message ='that is not your item';
                        break;

              }

         echo 
    $message;
         endfor; (
    in this line it is showing the error and the error is Parse errorsyntax errorunexpected T_ENDFOR)
         break;

         default:
         break;
         }
    }
    ?>
    <!DOCTYPE html>
    <html lang ="en">
         <head>
              <title>Prompt </title>
              <link rel="stylesheet" href="main.css">
              <link rel="stylesheet" href="prompt.php">
         </head>
         <body>
              <div id="wrapper>"
                             <?php headerAndSearchCode ();?>
                   <div id="outer">
                        <div id="inner">
                             <?php createMessage ($x); ?>
                        </div>
                             <?php footercode ();?>
                   </div>
              </div>
         </body>
    </html>

  12. #12
    SitePoint Member
    Join Date
    May 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks i corrected i closed my div as u said, and also i was using the wrong function endfor; thats why it was showing the error thanks, so now i am not using it anymore so its showing any error, thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •