Take the 2-minute tour ×

Before you continue reading, I want to note that I'm currently programming in the procedural style, because I want to learn the basics first before I advance to the more abstract side. Therefore solutions should be answered with the procedural style so I can understand it properly.

So, I'm creating a guestbook for some site. I've already made the first part for the user to post such as the message and then insert it into the db and now I want to extract the data from the db to view it.

Everything is on the same page (using php_self) the following code below is the second part (after the form where the user submits the name, email and message.)

I have also fixed a lot of errors that I made and now I can't get any further because I have no idea what is wrong.

I'm getting these notices:

Notice: Undefined variable: id in C:\UniServer\www\gastenboek.php on line 233 Notice: Undefined variable: id in C:\UniServer\www\gastenboek.php on line 234

that is:

line 233:

$row['id'] = $id;
line 234:
$id = mysqli_real_escape_string($link_view, $id);

I've also problems with the delete button which is visually a delete button image within a hidden form. It will only be visible if you're running the website in because of the function getRealIpAddr(). The problem is that I can't find a way to get the entry id of each message on the guestbook page to progress it in a sql query without a error, as i tried to put the variable which stores the id in the value parameter of the hidden html input then after post I should get it from $_POST, but doesn't work because I get an error then.

The code is in Pastebin: http://pastebin.com/BLVaS6qe stackoverflow doesn't allow copy->paste neither with that silly tool... lol

I really appreciate if anyone can solve this, because I've been trying to fix this almost the whole day.

Thank you in advance.

share|improve this question
It seems you are reading $id before it has any value in it –  alm Aug 27 '12 at 9:18
Well i fixed the notice errors but when i click on the delete button i delete all database entries –  Xenioz Aug 28 '12 at 19:20

Your Answer



Browse other questions tagged or ask your own question.