<div id='login-form' style='margin:auto;width:100%;margin-top:'> <form onsubmit="return Validate()"; action="registration_data.php" method="post" name="registration_form"> <p>Username: <input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;" type="text" name="username"/></p> <p>Password: <input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;" type="password" name="password"/></p> <p>Confirm: <input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;" type="password" name="passconf"/></p> <p>Name: <input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;" type="text" name="name"/></p> <p>Email: <input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;" type="text" name="email"/></p> <p><input style="border:1px solid #fff;min-height:25px;margin-top:5px;margin-bottom:5px;-moz-border-radius: 8px;-webkit-border-radius: 8px;padding:5px;"type="submit" value="Register" /></p> </form>
My problem is the users data is not being added to my table in my database and im not sure if its because of my form or my PHP
heres my registration_data.php file
<?php
session_start();
// form data
$submit = $_POST['submit'];
$name = strip_tags($_POST['name']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$passconf = strip_tags($_POST['passconf']);
$email = strip_tags($_POST['email']);
if ($submit)
{
//Connect to database
include_once "connection.php";
$namecheck = mysql_query("SELECT `username` && `email` FROM `carbonstudios` WHERE `username` = '$username' && `email` = '$email'");
$count = mysql_num_rows($namecheck);
if($count != 0)
{
die("Username is already taken!");
}
if($name && $username && $password && $passconf && $email)
{
if(strlen($username) > 32 || strlen($username) < 4 || strlen($name) > 64 || strlen($name) < 3 || strlen($email) > 255 || strlen($email) < 10)
{
echo "The length of your username, name, or email are either to long or to short!";
}else{
// check password length
if(strlen($password) > 20 || strlen($password) < 6)
{
echo "Password must be between 6 and 20 characters!";
}else{
// register the user
// encrypt password
$password = md5($password);
$passconf = md5($passconf);
$queryreg = mysql_query("INSERT INTO `carbonstudios` (id, username, password, name, email, admin)VALUES ('','$username','$password','$name','$email','0')");
echo "Registration Complete";
header('Location: ./index.php');
}
}
}
}
?>
and heres my connection file
<?php
$conn = mysql_connect("localhost", "root", "") or die("Could Not Connect");
mysql_select_db("users") or die("Could Not find Database");
?>
any help would be greatly appreciated this issue is very frustrating

New Topic/Question
Reply




MultiQuote







|