What I would like to happen is for a user to fill out a form and that information be sent to a database. I am using html and php in dreamweaver, and WAM with phpMyAdmin.
I have tried everything and I cannot seem to get my .php file to work with my localhost test server (or any server for that matter). It is a sign up registration form, and there is a html document and a php document, I will include both:
HTML Form:
<table width="15px" border="0">
<form form action="localhost.php" method="POST">
<tr>
<td>Username</td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Skype Name</td>
<td><input type="text" name="skype" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pass" /></td>
</tr>
<tr>
<td>Retype Password</td>
<td><input type="password" name="repass" /></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"/></td>
</tr>
</form>
PHP File:
<?php
$hostname= "localhost";
$database = "boost";
$username = "root";
$password = "";
$localhost = mysqli_connect($hostname, $username, $password, $database);
if(mysqli_connect_errno())
{
die('Connection Failed'.mysqli_error());
}
?>
<html>
<head>
<title>Sign Up</title>
</head>
<body>
<?php
if(isset($_POST['Submit']))
{
$username=$_Post['username'];
$skype=$_Post['skype'];
$email=$_Post['email'];
$pass=$_Post['pass'];
$repass=$_Post['repass'];
if(empty($username) || empty($skype) || empty($email) || empty($pass) || empty($repass))
{
echo "Cannot leave any field blank";
}
elseif ($pass!=$repass)
{
echo "Passwords did not match! Please try again.";
}
else
{
$sql="INSERT INTO users(Username,SkypeID,Email,Password) " .
"VALUES ('$username','$skype','$email','$pass')";
$res=mysqli_query($localhost,$sql);
if(!$res)
{
die("Query Failed" .mysqli_error($localhost));
}
else
{
echo "Welcome";
}
}
}
When I enter data into the fields to test it out, data is not sent to the localhost server (or the one connected to WAM). I don't know what I am doing wrong here. Are my HTML and PHP documents not interconnected to share values? Is there something wrong with the code? Am I not defining my database properly?
SOLUTION: My "POST" and "submit" where not being treated as case-sensitive. Thanks for the help.