Results 1 to 2 of 2
  1. #1
    dub is offline Member
    Join Date
    Jan 2014
    Rep Power

    Default Help me out whit my php code pls :)

    Hey, i know that i ask it on wrong place, but still mabey some 1 can help me :)
    I did start learn php few days ago.
    I have problem whit my if else statement. So it shold redirect me on next page, but it wount and it redirect me back on login page.
    I mean i get right value from login box and database, they match,but it still send me back index.php
    There is prob some better solution to do login(eaven to do it only inside the login page). All help is welcome ^^
    Here is login box in html.
    I wount use atm CompanyName, but i prob to it later.
    __________________________________________________ __________________________________________________ ________________

    <div id="loginbox">
    <form method="post" action="supplier_login.php">
    <table id="table">
    <td>Company name</td><td><input type="text" name="CompanyName"></td>
    <td>Username</td><td> <input type="text" name="username"></td>
    <td>Password </td><td><input type="text" name="password"></td>
    <td><a href="forgot">Forgot password?</a></td><td><a href="singup">Singup</a></td>
    <td></td><td><input id="button" type="submit" value="Login"></td>
    __________________________________________________ __________________________________________________ _____________
    Here is php code whis shold redirect Forward or backwards

    $con=mysqli_connect("localhost ","abc","abc123 ","bd");
    // Check connection
    if (mysqli_connect_errno())
    header("Location: index.php");
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    $result = mysqli_query($con,"SELECT `Username`,`Password` FROM `supplier`");

    while($row = mysqli_fetch_array($result)){

    if($row['username'] === $_REQUEST["username"] && $row['password'] === $_REQUEST["password"]){
    //if true redirect supplier.php
    header('Location: supplier.php');
    //else send back index.php
    header("Location: index.php");

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: Help me out whit my php code pls :)

    Can't help you. I suggest you go find a proper forum.

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. problem whit the scanner
    By Sanna.1 in forum New To Java
    Replies: 4
    Last Post: 02-10-2012, 02:04 PM
  2. Problems whit reading file from InputStream
    By nicox1984 in forum New To Java
    Replies: 1
    Last Post: 12-17-2011, 12:44 PM
  3. Replies: 3
    Last Post: 08-10-2011, 09:17 AM
  4. Replies: 0
    Last Post: 08-07-2011, 08:32 PM
  5. Replies: 0
    Last Post: 02-21-2011, 11:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts