Getting PHP Parse error: syntax error, unexpected T_ELSE in /home/aussiea1/public_html/classified_ad.php on line 18, below are the first 50 lines of code ur help is greatly apprieciated <? session_start(); error_reporting(0); require 'include/connect.php'; $user_id=$HTTP_SESSION_VARS[userid]; if($_GET) $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_GET['item_id']); $item_id = $corrected; echo $item_id; else if($_POST) $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_POST['item_id']); $item_id = $corrected; echo $item_id; $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_GET[mode]); $mode = $corrected; echo $mode; /* if(empty($HTTP_SESSION_VARS[userid])) { echo '<meta http-equiv="refresh" content="0;url=signin.php?url=detail.php&item_id='.$item_id.'&mode='.$mode.'">'; echo "<font size=+1 color=#003366>Loading....</font>"; exit(); } */ $bid_sql="select * from placing_item_bid where item_id=".$item_id; $bid_res=mysql_query($bid_sql); $row=mysql_fetch_array($bid_res); $high_feed_sql="select count(*) as feedbacktotal from feedback where feedback_to=".$row['user_id']; thanks in advance the else if($_POST) is line 18 btw
You need curly brackets around your if statements, for example: if(condition){ //Do this } else if(condition){ //do this } else{ //do this } PHP: The only time you can omit the curly brackets, is if you are only going to use 1 statement only, but you are using many. So basically your IF statement becomes this: if($_GET){ $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_GET['item_id']); $item_id = $corrected; echo $item_id; } else if($_POST){ $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_POST['item_id']); $item_id = $corrected; echo $item_id; $badwords = array("union", "select", "join", "concat", "from", "UNION", "SELECT", "JOIN", "CONCAT", "FROM"); $corrected = str_replace($badwords,"getalife",$_GET[mode]); $mode = $corrected; echo $mode; } PHP: assuming thats where the else if ends.