Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: Problem with php coding?

Your Message

Click here to log in

What is the number after 87?

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 01-22-2013, 01:50 PM
    Andres Acosta

    Problem with php coding?

    Im new to php and i/m making a php website... everything works fin until i put the php code. when i see the page in the browser it shows the php code as text and i don't know whats wrong with it. <?php
    $form ="<form action = 'login.php' method = 'post'>
    <table>
    <tr>
    <td><input type = 'text' id='usernamebox' name='username' tabindex='1' value='Username' class='textbox' onfocus='usernamebox_focus();' onblur='usernamebox_blur();'></td>
    <td><a href='register.php'>Register</a></td>
    </tr>

    <tr>
    <td><input type = 'password' id='passwordbox' name='password'tabindex='2' value='Password' class='textbox' onfocus='passwordbox_focus();' onblur='passwordbox_blur();'></td>
    <td><input type ='submit' name='loginbutton' value='Login'tabindex='3' class='button'></td>
    </tr>
    </table>
    </form>";

    if ($_POST['loginbutton']){
    $user = $_POST['username'];
    $password = $_POST['password'];
    if ($username && $password && $usename!="Username"){
    require("design/connect.php");
    $password = md5($password);
    $query = mysql_query("SELECT * FROM users WHERE username = '$user' AND password = '$password'");
    $numrows = mysql_num_rows($query);
    if ($numrows == 1){
    $rows = mysql_fetch_assoc($query);
    $dbuser = $rows['username'];
    $dbid = $rows['id'];

    $_SESSION['user']= $dbuser;
    $_SESSION['id']= $dbid;
    echo"<center>You are logged in.</center>";
    }
    else
    echo "<center>Username not found</center>";
    }
    else
    echo"<center>You did not submit a username and/or password.</center>";
    }

    else{
    echo "$form";
    }

    ?>

    any help is appreciated

Posting Permissions

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