Hi,
This probably has an extremely stupid answer, but I'm just beginning to learn PHP in an attempt to have a working registration program for my website. I have made the HTML and PHP the way that several tutorials online have showed me, and I want to make it so that when you register under a username, password, etc, that data goes into my MySQL database so that it can remember you the next time you log in.
The problem is, when I run the HTML and it calls the PHP, I get an error in line 39, char 2, which doesn't even exist in my PHP file. Code 0, 'object expected'. I wish they could try to be a little more specific as to what went wrong...
If it helps, here's my HTML code
And the PHP code is just down to its bare bones and not transmitting everything yet, but I wanted to see if it would work first to transmit data to my database:
Thanks for helping!
--Gladi8r
This probably has an extremely stupid answer, but I'm just beginning to learn PHP in an attempt to have a working registration program for my website. I have made the HTML and PHP the way that several tutorials online have showed me, and I want to make it so that when you register under a username, password, etc, that data goes into my MySQL database so that it can remember you the next time you log in.
The problem is, when I run the HTML and it calls the PHP, I get an error in line 39, char 2, which doesn't even exist in my PHP file. Code 0, 'object expected'. I wish they could try to be a little more specific as to what went wrong...
If it helps, here's my HTML code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Register for an account on xxxx!</title> </head> <body> <form action="http://subdomain.mywebsite.com/submitinfo.php"> Username: <input type="text" name="Username"> <br /> Full Name: <input type="text" name="Name"> <br /> Password: <input type="password" name="Password"> <br /> Confirm Password: <input type="password" name="Confirm Password"> <br /> E-mail: <input type="text" name="E-mail"> <br /> Confirm E-mail: <input type="text" name="Confirm E-mail"> <br /> Gender:<br /> <input type="radio" name="Gender"> Male<br /> <input type="radio" name="Gender"> Female<br /> <input type="submit" name="Submit"> </form> </body> </html>
Code:
<?php
$link = mysql_connect ("xx.x.xxx.xxx", "myusername", "mypassword")
or die('Could not connect ' . mysql_error());
mysql_select_db ("myusername", $link) or die('Could not select database.');
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$Name = $_POST['Name'];
$Email = $_POST['E-mail'];
$sql="INSERT INTO Usernames and Passwords (Username, Password, E-mail, Name) VALUES ($Username,$Password,$Email,$Name)";
if (!mysql_query($sql,$link))
{
die('Error: Couldn''t insert the data.' . mysql_error());
}
mysql_close($link);
?>
--Gladi8r
Comment