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 -
<!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>
-
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: -
<?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);
-
?>
-
Thanks for helping!
--Gladi8r
8 2709
can't make any sense of the error message either, maybe copy and post the error message directly from the browser...
nevertheless, you are trying to access a variable you don't have. the error lies within the HTML code. in the <form> tag you don't specify the transfer method (get or post) which then defaults to "get". thus you have no $_POST data.
furthermore, your SQL looks weird. if I read the manual right, you have to specify one table, not sure if "Usernames and Passwords" conforms to the SQL naming scheme here.
I had made a table called Usernames and Passwords for user data earlier on my database. I inserted some data from the manager, and it didn't seem to care.
When I changed my method to "post" in my HTML, it came back with the exact same error:
Line: 39
Char: 2
Error: Object expected
Code: 0
URL: <Url removed - just lead to an advertising page>
to me it looks more like a javascript error on IE....
Then is there any way I can fix it so that it works with my browser?
I think so, but without knowing the javascript I cannot tell. maybe it helps if you disable javascript.
It's just a bit odd. I've never had to do that on a registration before.
Heya, gladi8r.
You've probably got some spyware or malware on your computer that's causing the JS error. Try running a spyware/malware removal tool and seeing if the problem goes away.
Alternatively, try accessing the PHP script on a different computer.
Atli 5,058
Expert 4TB
Hey, I get it now... IE's poor JavaScript support is a security mechanism :]
You could try installing Firefox and viewing the page in that.
If the error still shows up, Firefox should give you a better idea as to why and where it is happening.
If it doesn't, pbmods is probably right (which he usually is) and you have a spyware/malware/virus problem going on.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: joemyre |
last post by:
Hi everyone,
What I'm trying to do is take php variables i got from user input, and
pass them as the MySQL query terms.
$query = "select * from ident where ".$searchtype1."=".$searchterm1."";...
|
by: Matthew Sims |
last post by:
I've been performing search after search all over the internet reading
up on all topics about making PHP secure with MySQL. There's a lot out
there and not many concrete examples on how you should...
|
by: Yossi Naggar |
last post by:
Hello to everyone,
I am an experienced user in MSSQL Server.
Lately I have been started using MySQL. I managed to create my
database and tables.
When I wanted to execute the following query:...
|
by: Bill |
last post by:
I call a function in my .js file like this:
onClick="location.href='blank.html' +
generateSearchStringFromForm('section')"
where section is the name of my form.
The function is defined as...
|
by: MLH |
last post by:
I'm supposed to set a password for the MySQL root user. The output of
mysql_install_db instructed me to run the following commands...
/usr/bin/mysqladmin -u root -h appserver password mynwewpasswd...
|
by: Dave Hammond |
last post by:
In document "A.html" I have defined a function and within the document
body have included an IFRAME element who's source is document "B.html".
In document "B.html" I am trying to call the function...
|
by: MLH |
last post by:
Suppose I have this simple SQL string...
SELECT tblDrivers.DriverID, tblDrivers.DName
FROM tblDrivers
WHERE (((tblDrivers.DName) Like "N*"))
ORDER BY tblDrivers.DriverID;
And suppose that...
|
by: gooderthanyou |
last post by:
Alright i've looked a ton of topics and most of them are unresolved...
configure: error: Cannot find MySQL header files under usr/local/mysql.
Note that the MySQL client library is not bundled...
|
by: kennthompson |
last post by:
Trouble passing mysql table name in php. If I use an existing table
name already defined everything works fine as the following script
illustrates.
<?php
function fms_get_info()
{
$result =...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |