Home > Archive > PHP Programming > June 2007 > Newbie
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Reggie 2007-06-29, 7:00 pm |
| Notice: Undefined variable: submit in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/create_entry.php on line 7
not registered
This is an error message i get when trying to setup userlogin on my
website.
This is my code please help.
<?php
mysql_connect("localhost", "root") or
die ("Could not connect to database");
mysql_select_db("user") or
dir ("Could not select database");
if ($submit == "Register")
{
$query = "insert into user
(username, password) values ('$username', '$password')";
mysql_query($query) or
die (mysql_error());
?>
<h3>You are now registered</h3>
<a href="index.html">Go back to main page</a>
<?php
}
else
{
print("not registered");
}
?>
| |
| ZeldorBlat 2007-06-29, 7:00 pm |
| On Jun 29, 11:15 am, Reggie <joelregisfo...@hotmail.com> wrote:
> Notice: Undefined variable: submit in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/create_entry.php on line 7
> not registered
>
> This is an error message i get when trying to setup userlogin on my
> website.
>
> This is my code please help.
>
> <?php
>
> mysql_connect("localhost", "root") or
> die ("Could not connect to database");
> mysql_select_db("user") or
> dir ("Could not select database");
>
> if ($submit == "Register")
> {
> $query = "insert into user
> (username, password) values ('$username', '$password')";
> mysql_query($query) or
> die (mysql_error());
> ?>
> <h3>You are now registered</h3>
> <a href="index.html">Go back to main page</a>
> <?php}
>
> else
> {
> print("not registered");}
>
> ?>
You get the error because $submit is not defined. You need to use
$_POST['submit'] (and probably $_POST['username'] and
$_POST['password'] as well).
Read this:
<http://www.php.net/manual/en/langua....predefined.php>
And pay special attention to the notes about register_globals.
| |
| Andrew Hutchings 2007-06-29, 7:00 pm |
| ZeldorBlat wrote:
> On Jun 29, 11:15 am, Reggie <joelregisfo...@hotmail.com> wrote:
[color=darkred]
> You get the error because $submit is not defined. You need to use
> $_POST['submit'] (and probably $_POST['username'] and
> $_POST['password'] as well).
>
> Read this:
>
> <http://www.php.net/manual/en/langua....predefined.php>
>
> And pay special attention to the notes about register_globals.
>
It should also be noted that Notices are not Errors as such. Your
script will normally execute fine with Notices but for improved security
and performance you should try to avoid them.
--
Andrew Hutchings - LinuxJedi - http://www.linuxjedi.co.uk/
Windows is the path to the darkside...Windows leads to Blue Screen. Blue
Screen leads to downtime. Downtime leads to suffering...I sense much
Windows in you...
|
|
|
|
|