0
<?
if(isset($_POST[b1]))
{
    $m= new myclass();
    $x=$m -> validlogin($_POST[t1],$_POST[t2])
#   if ($x== true) #
    {
        $_SESSION[username]=$_POST[t1];
        ?>
        <? include ("menu.php");?>
         <script type="text/javascript">

        window.location = "cpanel.php";
        </script>
     <?

     }

     else {
     echo "invaild login";

     }
}

?>

        }
    }
?>
2
Contributors
4
Replies
8
Views
4 Years
Discussion Span
Last Post by LastMitch
0

Parse error: syntax error, unexpected T_IF in E:\AppServ\www\society\myadmi

Which line? You have to explain what error you are having.

0
if ($x== true) in line 6

Why did you put a # on that line? Take out the #.

I tried to find fault but I can not I'm new in php

Why did you click solve so soon?

Was that the only error you have or you have others?

Are you connected to the database?

It's not good to write the code like this:

<?php
if(isset($_POST[b1])){
$m= new myclass();
$x=$m -> validlogin($_POST[t1],$_POST[t2])
if ($x == true){
$_SESSION[username]=$_POST[t1];
?>

<?php include ("menu.php");?>

<script type="text/javascript"> 
window.location = "cpanel.php";
</script>
<?php }else {
echo "invaild login";
}}?>
}}
?>

Try this:

<?php
include ("menu.php");

if(isset($_POST[b1])){
$m= new myclass();
$x=$m -> validlogin($_POST[t1],$_POST[t2]);

if ($x == true){
$_SESSION[username]=$_POST[t1];

echo '<script type="text/javascript"> 
window.location = "cpanel.php";
</script>';

}else {
echo "invaild login";
}}
?>

I got no idea what other errors you got.

Edited by LastMitch: grammer

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.