Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

[Help] Login system

General discussions related to php

Moderators: macek, egami, gesf

[Help] Login system

Postby ganjaboss » Sun Jan 19, 2014 1:17 pm

Hello all coders out there! :)
Well i'm new in this coding thing, and i'm not good at it - at all...
So i thought maybe some of you could help me out :)

Here is my code..





<form action="login.php" method="post">
<div class="logo">

<span id="logo_holder">
<a href="localhost/login.php">
<img src="logo.png" width="176" height="44">
Username: <input type="text" name="username"/><br/>
Password: <input type="password" name="password"/><br/>
<input type="submit" name="submit" value="Login"/>


include 'config.php';
mysql_connect($host, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());

if ($_POST['submit']) {

//Get Form-Data
$myusername = $_POST['username']();
$mypassword = $_POST['password']();

//Check The Fields
if ((!$myusername) || (!mypassword) ) {

echo "Please fill in all fields!";


//Check the form in the db



And my config..


$user = "root";
$host = "localhost";
$password = "";
$database = "userdb";
$usertable = "users";


Check out the picture..

What can cause this, and what have i done wrong? :P
Thanks in advance!
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jan 19, 2014 1:04 pm

Re: [Help] Login system

Postby MarioParty » Sat Feb 08, 2014 9:42 am

Nothing wrong, you just need to check that the variable has been defined, otherwise PHP can't access it.

Code: Select all
if ($_POST['submit']) {

Code: Select all
if (isset($POST['submit'])) {
New php-forum User
New php-forum User
Posts: 42
Joined: Tue Aug 02, 2011 2:52 am

Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.