1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help session couldnt start???

Discussion in 'Web & Internet' started by zanlii07, Mar 17, 2016.

  1. Mga master ? ive created a website then my session couldnt start? Hindi po sya gumagana
    pa help po pls. thankyou !

    Here's mycode:

    <?php session_start();?>
    <HTML>
    <HEAD>
    <TITLE>Login</TITLE>
    </HEAD>
    <BODY bgcolor="rgb(67,87,51)">

    <table border="1" width="100%">
    <tr>
    <td><?php


    $linkID=mysql_connect("127.0.0.1","root");
    mysql_select_db("hotel_booking5",$linkID);

    ?>
    <form action="<?php echo $_SERVER["PHP_SELF"];?>"
    method="post"> <BR>
    <b>username(family)</b>
    <input name="user" type="text" size="10"/>
    <br> <BR>
    <b>password</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="password" type="password" size="10"/>
    <br> <BR>


    <input type="submit" name="log-submit" value="logsubmit" size="20">
    <input type="submit" name="signup" value="signsubmit"size="20">
    </form>
    <?php

    $query = 'select password from customers where family= "'.$_POST['user'].'"';
    $result=mysql_query($query,$linkID);
    $row=mysql_fetch_assoc($result);


    if($_POST['password']==$row['password'] && $_POST['password']!= '' && $_POST['user']!=''){

    //$url="reservation.php";
    //echo $url;
    echo "validation has been done!";
    $query4 = 'select customer_id from customers where family= "'.$_POST['user'].'"';
    $logresult=mysql_query($query4,$linkID);
    $logrow=mysql_fetch_assoc($logresult);

    $_SESSION['customer']= $logrow["customer_id"] ;
    $_SESSION['user']= $logrow["user"] ;
    ?>
    <a href="reservation.php?custID=<?php echo $logrow["customer_id"] ;?> " > if you want to continue please click here! </a>
    <?php

    }
    else if ($_POST['password']!=$row['password']) {

    echo "invalid password, try again";
    ?>
    <BR>
    <a href="signup.php"><p><b>if you are new,you can create your account right now </b></p></a>
    <?php

    }

    // echo("HHHHHHHHHHHH:");
    //echo($_POST['user']);
    ?>
    </td>
    <td> <img src="5.jpg" style="position:relative; width="100" height="600" left:0px;
    top:100px;"> </td>
    </tr>
    </table>


    </BODY>
    </HTML>
     
Tags / Keywords: