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.

Recommended Answers

All 4 Replies

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;'

There is one extra brace before break.

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

Thanks. :)

Member Avatar for diafol

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.

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.