...

View Full Version : Error



weronpc
04-17-2003, 05:37 PM
I installed php, mysql and aparche 2.0

for some reason, I get this message when I use $_POST[delete] and $_GET[delete]. (delete is the name of a submit button)

Notice: Use of undefined constant delete - assumed 'delete' in C:\user\share\public\web\developer\guest_book\guest_modify.php on line 16

everything works fine, just keep getting this message.

line 16
if ($_POST[delete]){

Thank you,

Mike

beetle
04-17-2003, 06:02 PM
The error message tells you exactly what it's looking for

Notice: Use of undefined constant delete - assumed 'delete' in C:\user\share\....

if ( $_POST['delete'] ) {

You must lookup those members as a string, unless already inside a literal string, where you should remove them

echo ( "The value for delete is $_POST[delete]" );


:thumbsup:

weronpc
04-17-2003, 06:17 PM
Another notice message

Notice: Undefined index: mode in C:\user\share\public\web\developer\guest_modify.php on line 46

Line 46: if($_GET['mode'] == 'update'){

Thanks

Mike

beetle
04-17-2003, 06:18 PM
Try this
if ( isset( $_GET['mode'] ) && $_GET['mode'] == 'update' ) {

weronpc
04-17-2003, 06:23 PM
Thank you so much, you are great help

Can you explain why it wasn't working before? :)

I want to know learn....

duniyadnd
04-17-2003, 06:25 PM
You were missing the single quotes around the variables inside the square brackets. An error if you calling in something that wasn't defined in the first place.

Duniyadnd

beetle
04-17-2003, 06:29 PM
Well, again the error says it all

Undefined index: mode

That means the index 'mode' wasn't defined in the $_GET array at all. Since it's not defined, you can't check it's value and thus get that error.

You first need to see if it exists, which isset() is used for.

duniyadnd
04-17-2003, 06:37 PM
OOOooops... missed that part..

:o

Thanks Beetle



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum