0

Parse error: syntax error, unexpected T_CASE in /home/redlimbc/public_html/M2H/article.php on line 757

<?php
break;

case "yorumonay": 
$id = $_GET['id']; 
$yorum_adsoyad = str_replace("'", "\'", $_POST['yazan']);
$yorum_email   = str_replace("'", "\'", $_POST['mail']);
$yorum_yorum   = str_replace("'", "\'", $_POST['yorum']);
$tarih = date("d.m.Y");

if(($yorum_adsoyad == "") or ($yorum_email == "") or ($yorum_yorum == "")){ 
	echo '<script type="text/javascript">alert("Bo? b?rakt???n?z alanlar var!");</script>';
	echo '<meta http-equiv="refresh" content="0;URL=yazi.php?id='.$id.'">';
}else{
$yorum_kaydet = mysql_query("INSERT INTO yorumlar (makale_id,yazan,mail,tarih,yorum) VALUES ('$id','$yorum_adsoyad','$yorum_email','$tarih','$yorum_yorum')");
	if($yorum_kaydet){ 
		echo '<script type="text/javascript">alert("Success!");</script>';
		echo '<meta http-equiv="refresh" content="0;URL=yazi.php?id='.$id.'">';
	}else{ 
		echo '<script type="text/javascript">alert("Error!");</script>';
		echo '<meta http-equiv="refresh" content="0;URL=yazi.php?id='.$id.'">';
	}
}
break;
}
?>

Help me please.

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by diafol
0

unexpected T_CASE means you have a case statement that has somehow become disconnected from it's switch.

Are you showing the whole switch statement in the code you posted?

A switch statement should be formed as follows (Taken from the PHP manual):

switch ($i) {
    case 0:
        echo "i equals 0";
        break;
    case 1:
        echo "i equals 1";
        break;
    case 2:
        echo "i equals 2";
        break;
}
?>

Check whether your statement follows this structure. Also, I notice that you have an unmatched closing brace after the last 'break;'

0

There is one extra brace before break.

echo '<meta http-equiv="refresh" content="0;URL=yazi.php?id='.$id.'">';
	}
[B]}[/B]
break;
}
?>

Edited by vibhaJ: n/a

0

I know this is solved, BUT, I'd use a php header to redirect after a certain no. of seconds. This means you can show a page of info and it works if JS is turned off.

header('Refresh: 10; url=http://www.example.org/');

This will redirect after 10 seconds.

You can echo anything you want below that line.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.