adzi Posted December 10, 2007 Share Posted December 10, 2007 Hi, I'm pretty new to the whole PHP coding side of websites. I'm trying to create a very simple, very basic members login system for my website where only registered members can access. It doesnt have to be 100% secure at the moment as that's what Im looking to improve but I cant seem to get the fundamentals sorted. This is my register.html code, with a simple form capturing the data. <form name="register" method="post" action="register.php"> <input name="register_name" type="text" value="username" size="20"/><br> <input name="register_password" type="password" value="password" size="20"/><br> <input name="password_reminder" type="text" value="password reminder" size="20"/><br> <input name="register_email" type="text" value="email" size="50"/><br> <input type="submit" name="submit" value="submit"/> <input type="reset" name="reset" value="reset"/> </form> Here's my register.php page thats called when the submit button is hit. <?php $register_name = $_POST['register_name']; $register_password = $_POST['register_password']; $register_email = $_POST['register_email']; $password_reminder = $_POST['password_reminder']; @mysql_connect("localhost", "My Database User", "My database password") or die("Cannot connect to database."); @mysql_select_db("centrest_members") or die("Cannot select database"); $insert = mysql_query("insert into users values ('NULL','".addslashes($register_name)."', '".sha1($register_password)."','".$password_reminder."','".$register_email."')") or die("Could not insert data because ".mysql_error()); ?> I get the error, Parse error: syntax error, unexpected T_VARIABLE in /home/centrest/public_html/adzi/register.php on line 2 Can anyone help as to why this is happening? Thanks, Adzi Edit: This is my SQL table structure; id smallint(6) auto_increment register_name varchar(15) register_password varchar(20) register_email varchar(50) password_reminder varchar(30) Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 10, 2007 Share Posted December 10, 2007 there does not seem to be any syntax(Parse error) in your code however try saving the file again. Quote Link to comment Share on other sites More sharing options...
adzi Posted December 10, 2007 Author Share Posted December 10, 2007 Im still getting the same error. Parse error: syntax error, unexpected T_VARIABLE in /home/centrest/public_html/adzi/register.php on line 2 Any other ideas? Cheers, Adzi Quote Link to comment Share on other sites More sharing options...
revraz Posted December 10, 2007 Share Posted December 10, 2007 If you comment line 2 out, does it still error? Quote Link to comment Share on other sites More sharing options...
adzi Posted December 10, 2007 Author Share Posted December 10, 2007 Yes, same error, but line 3. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 10, 2007 Share Posted December 10, 2007 See if renaming it helps $register_name = $_POST['register_name']; to $name = $_POST['name']; and change your form and sql statement to match. Echo the $_POST variable to see its data. Try having data instead of the $_POST variable, like $register_name = "hi"; Using a normal text editor? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.