Here is my code and on line 3, it says their is an unexpected T_IF error: <?php $pass = $_POST ['pass'] if ($pass == 'Pivet');{ echo 'Header("Location:http://www.new-site.com");'" } else { echo 'InCorrect Password; } ?> Code (markup): Please tell me what is wrong
<?php $pass = $_POST ['pass'] [B]<< remove the space between $_POST and ['pass'] here[/B] if ($pass == 'Pivet')[B];[/B]{ [B]<< remove the semicolon here, this was causing the error - semicolon's don't go there[/B] echo 'Header("Location:http://www.new-site.com");'[B]"[/B] [B]<< remove the " and entire echo statement here and move the semicolon to the end of the line, this would have later caused an error - headers are outputted by the Header function, echo is unnecessary (and may have caused an error)[/B] } else { echo 'InCorrect Password; [B]<< add an ' after the Password and before the semicolon, this would have later caused an error[/B] } ?> Code (markup): This code below is the code you want, read the code above for information on what I did. <?php $pass = $_POST['pass'] if ($pass == 'Pivet') { Header("Location:http://www.new-site.com"); } else { echo 'InCorrect Password'; } ?> Code (markup):
Well... the actual error is probably coming from the lack of a semi-colon at the end of the: $pass = $_POST['pass'] but yeah, the rest is all necessary, too... no offense, but that code snippet probably has the highest errors / line I've ever seen...