[SOLVED] litlle help need..
Posted: Tue Jul 27, 2004 9:32 pm
This is the form: addform.php
add_user_func.php:
Here is the problem:
I have fill in all the field in the form but why it still show the message ("YOU DIDN'T FILL IN ALL THE REQUIRED FIELDS.")
Code: Select all
<?php
function user_form()
{
?>
<b>Username:</td><td><input type="text" name="username"></td></tr>
<b>Password:</td><td><input type="text" name="password"></td></tr>
<form action="add_user_func.php" method="POST">
<input type="submit" value="SAVE" name="submit"></form>
<?
}
user_form();
?>Code: Select all
<?php
require_once 'addform.php';
include("database.php");
include("login.php");
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', '');
define('DB', 'db1');
if ($REQUEST_METHOD=="POST")
{
if (!$_POST['username'] || !$_POST['password'])
{
echo("YOU DIDN'T FILL IN ALL THE REQUIRED FIELDS.");
}
$username = $_POST['username'];
$md5pass = md5($_POST['password']);
global $conn;
$q = "INSERT INTO employee VALUES ('$username', '$md5pass')";
return mysql_query($q,$conn);
$result = mysql_query($q, $conn);
if (!$result)
{
echo("ERROR: " . mysql_error() . "\n$q\n");
}
echo("DATA SUCCESSFULY ADDED\n");
}
?>I have fill in all the field in the form but why it still show the message ("YOU DIDN'T FILL IN ALL THE REQUIRED FIELDS.")