I get no errors but nothing get entered in the DB
here's my code
register.php
<html>
<head>
<script type="text/javascript">
function Unamehelp()
{
alert("Maximum 15 characters,only letters and numbers" + '\n' + "allowed.");
}
function passhelp()
{
alert("Maximum 30 characters,only letters and numbers" + '\n' + "allowed");
}
function scndpasshelp()
{
alert("Input the password exactly as above");
}
function campnamehelp()
{
alert("Maximum 15 characters,only letters and numbers" + '\n' + "allowed" + '\n' + "" + '\n' + "Your Camp's name");
}
function leadnamehelp()
{
alert("Maximum 15 characters,only letters and numbers" + '\n' + "allowed" + '\n' + "" + '\n' + "Your camp leader's name");
}
</script>
</head>
</head>
<body>
<center>
<form action="register.php?add=yes" method="post">
Username <input type=text name="username"> <a href="javascript:Unamehelp();"><b>?</b></a><br />
Password <input type=password name="password"> <a href="javascript:passhelp();"><b>?</b></a><br />
Password Again <input type=password name="password2"> <a href="javascript:scndpasshelp();"><b>?</b></a><br />
Camp name <input type=text name="campname"> <a href="javascript:campnamehelp();"><b>?</b></a><br />
Leader's name<input type=text name="leadername"> <a href="javascript:leadnamehelp();"><b>?</b></a><br />
<input type="submit" value="Go!">
</center>
</form>
<?php
if ($add=='yes')
{
include ('functions.php');
testifempty();
if ($_POST[password] == $_POST[password2])
{
include ('config.php');
$securepass= encryptdata($_POST['password']);
$get="INSERT INTO Users (username, password, campname, leadername) VALUES ('$_POST[username]','".encryptdata($_POST['password'])."','$_POST[campname]','$_POST[leadername]')";
if (!mysql_query($get,$con))
{
die('Error: ' . mysql_error());
}
echo "You have successfully registered";
echo "<br/>";
echo "You can now login";
echo "<a href=/login.php>here</a>";
mysql_close($con);
}
else
{
echo "Passwords do not match";
}
}
?>
</body>
</html>
and the function is here
function encryptdata($string)
{
$passmd5 = md5($string);
$passenc = sha1($passmd5);
}
I've also tried doing this
$securepass= encryptdata($_POST['password']);
$get="INSERT INTO Users (username, password, campname, leadername) VALUES ('$_POST[username]','$securepass','$_POST[campname]','$_POST[leadername]')";
Can anybody please tell me where is my error?
Thanks in advance