Jump to content

usman07

Members
  • Posts

    310
  • Joined

  • Last visited

    Never

Everything posted by usman07

  1. is the closing bracket meant to be after "username"> or after method="post"/> thx
  2. is the closing bracket meant to be after 'username' or after 'post'?thx
  3. The error: PHP Error Message Parse error: syntax error, unexpected $end in /home/a3073051/public_html/index.php on line 167 Free Web Hosting
  4. Jacbey I have tried your way, but I am getting a syntax error?
  5. iv renamed the file,but the php still opens up in a new page,rather than on the html page.
  6. "AddType application/x-httpd-php .html" is that the correct code to insert in the htaccess file?
  7. So i rename the 'index.html' file to 'index.php', and include the neccessary code in the htaccess file. and thats it? and it would still work with the php file and index file being seperate but in the directory?
  8. Thank you both for your replies, I will now insert my codes to gives you a better idea. PHP code: <?php $username = $_POST["username"]; $password = $_POST["password"]; if ($username&&$password) { $connect = mysql_connect("mysql13.000webhost.com","a3073051_shakoor","usman1") or die("Couldn't connect!"); mysql_select_db("a3073051_login") or die("Couldn't find db"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) { while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } //check to see if they match if ($username==$dbusername&&$password==$dbpassword) { echo "You're in!"; } else echo "incorrect password!"; } else die("That user does not exist!"); } else die("Please enter a username and password!"); ?> HTML code (only the login,the whole html code is really long) <div id="username"> <form action="login.php" method="post"/> <table><tr><td> <img src="imgs/Log In/username.png" alt=""/> </td><td> <input type="text" size="30" name="username" style="background-color:transparent;" /> </td></tr></table> <table><tr><td> <img src="imgs/Log In/password.png" alt=""/> </td><td> <input type="password" name="password" size="30" /> </td></tr></table> <form id="submitb" action=""> <input type="submit" value="Log in" /> </form> <p class="register">Not yet a member? <a href="Form.html">Register Here</a>, its Free!</p> </div>
  9. i am new to php, but i have written a php code for a login, basically i have my index html page separate, so when i put it on the server, when i press log in, it takes me to another blank page, with written either saying your logged in, or incorrect password, so this proves my php code works. But what i want is the writing to be displayed on my html file. Could I run the php code on the html file with the two files being separate? or do i have to insert the php code in the html file? or other way around? (but when i do this, it ruins my html file and things below just disappear. What I already know: that I have to edit the .htacess file and include a line of code would appreciate ur help, thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.