Well i can tell you immediately that THAT isnt going to work.
Your form code cant be inside the PHP bare like that.
Lets wrap it in some tags and see if we can see anything else glaring...
PHP Code:
<?php
$host = 'AAAAAA';
$user = 'AAAAA';
$pass = 'AAAAAA';
$db = 'AAAAA';
$connect = mssql_connect($host,$user,$pass) or die('Unable to connect');
$database = mssql_select_db($db,$connect) or die('Unable to connect to selected database');
if(isset ($_POST(['submit'])))
{
$email = S_POST['email'];
$firstname = S_POST['firstname'];
$lastname = S_POST['lastname'];
$pwd = S_POST['pwd'];
if trim($firstname) == "" || trim($lastname)=="" || trim($pwd)== ""
{
echo 'You must enter both a firstname, lastname and password!!';
}
else
{
$sql = "INSERT INTO users ([email],[first_name],[last_name],[password])VALUES('$email','$firstname','$lastname','$pwd')";
$result = mssql_query($sql);
if(!$result)
{
echo mssql_error();
exit;
}
mssql_free_result($result);
mssql_close();
echo "Data successfully inserted!!";
}
}
<form method = "post" action = "check.php">
Email : <input type="text" name="email"><br>
First Name: <input type="text" name="firstname"><br>
Last Name : <input type="text" name="lastname"><br>
Password : <input type="password" name="pwd"><br>
<input type="submit" name="submit" value="Register"
</form>
?>
Input tag on the second-to-last last line is missing it's >.
Right, so... doesnt immediately look like anything else is wrong... shift that ?> up to above the <form> tag, and see if that comes out the way you'd like.
Bookmarks