View previous topic :: View next topic |
Author |
Message |
Spasm -
Joined: 12 Nov 2003 Posts: 7
|
Posted: Tue Nov 18, 2003 10:44 am Post subject: Can anyone get below tutorial to work ? |
|
|
Hi, I'm a real php/mysql newbie, who is trying to learn how it works.
I've visited php.net, and tried the tutorial at:
http://www.awtrey.com/support/dbeweb/
First I tried to type in the complete code, and created the database, but I think I made some typos, that I couldn't find.
So I downloaded the complete source, and added my database information.
(host, pasword, database) inside the code.
Now I am getting the following errormessages:
Notice: Undefined variable: notall in C:\Program Files\Abyss Web Server\htdocs\guestbook.php on line 96
Notice: Undefined variable: complete in C:\Program Files\Abyss Web Server\htdocs\guestbook.php on line 160
I've tried to edit php.ini and set register_globals = on like suggested in some other topics, but this doesn't seem to work :(
[slightly offtopic]
Is it sensible btw to set globals on ? The following is stated in my php.ini:
Code: |
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
|
[/slightly offtopic]
Can any of you guys get it to work, or is it just poor coding of the author, which I doubt, because it's recommende by php.net ? |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Nov 18, 2003 8:57 pm Post subject: Re: Can anyone get below tutorial to work ? |
|
|
Spasm,
Search for "Undefined variable" in this forum for more information. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Spasm -
Joined: 12 Nov 2003 Posts: 7
|
Posted: Wed Nov 19, 2003 8:39 am Post subject: Re: Can anyone get below tutorial to work ? |
|
|
aprelium wrote: | Spasm,
Search for "Undefined variable" in this forum for more information. |
Will do aprelium, thanx ! |
|
Back to top |
|
|
Spasm -
Joined: 12 Nov 2003 Posts: 7
|
Posted: Wed Nov 19, 2003 12:21 pm Post subject: |
|
|
Okay, i've read some topics about this problem, and understand
that it has something to do with the new php rules, and that I should something like GET, or POST.. The last part isn't completly clear to me.
How would I have to change this code:
Code: |
<? if ($notall == 1) { ?>
|
|
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Nov 21, 2003 1:47 am Post subject: |
|
|
Code: |
<? if ($notall == 1) { ?>
|
becomes
Code: |
<? if ($_REQUEST['notall'] == 1) { ?>
|
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Spasm -
Joined: 12 Nov 2003 Posts: 7
|
Posted: Fri Nov 21, 2003 10:21 am Post subject: |
|
|
aprelium wrote: | Code: |
<? if ($notall == 1) { ?>
|
becomes
Code: |
<? if ($_REQUEST['notall'] == 1) { ?>
|
|
Thanx !
But now I get an Undefined index
Code: |
Notice: Undefined index: notall in C:\Program Files\Abyss Web Server\htdocs\gastboek.php on line 96
|
I will search this forum about this index first, but if I fail to find it,
could someone please be so kind to help me out ?
Ps.
I know I can easily get rid of the errors by setting display_errors = on to off, but that cannot be the correct way to go, can it ? |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Nov 24, 2003 4:36 pm Post subject: |
|
|
Spasm,
It isn't an error. It is just a notice (notices are just "notices", nothing more). Notices can be useful when debugging a script but usually you'll have to disable displaying them.
Open php.ini, locate the line starting with error_reporting, and change it to:
Code: |
error_reporting = E_ALL & ~E_NOTICE
|
This instructs PHP to only display errors and warnings. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Spasm -
Joined: 12 Nov 2003 Posts: 7
|
Posted: Tue Nov 25, 2003 8:41 am Post subject: |
|
|
Ok, I get it now thanx for your help will edit php.ini. |
|
Back to top |
|
|
topniz -
Joined: 11 Nov 2003 Posts: 35 Location: Metz-France
|
Posted: Tue Nov 25, 2003 2:52 pm Post subject: |
|
|
Look Spasm, try this for me :
when you call your guestbook.php page, try to add '?notall=' to the url (without assigning any value to your notall)
Do the same for all your noticed undefined variables that way:
http://localhost/guestbook.php?notall=&undefvar=&undefvar2='
without assigning values to your undefs.
Or best, try to assign them good values if you understand the overall logic of the guest book script.
furthermore, PHP is case sensitive. So, if your variables are declared with some caps in them, the caps should be respected : example:
if the url is 'http://localhost/guestbook.php?notAll=1...'
so '$notall' variable should be '$notAll' (notice the capitalized A)...
let me know if that works... _________________ ToPniz
"Don't ask what the community could do for you but ask what you could do for the community" |
|
Back to top |
|
|
|