Forum Moderators: coopster

Message Too Old, No Replies

Hyperlinking

         

prometheus6000

12:12 pm on Sep 2, 2007 (gmt 0)

10+ Year Member



I am working on a page that shows you data from MYSQL on php. Then there is a link close to every record that says "Delete". I have created the serverside scripts that would delete the data from mysql table. How do I link "Delete" in such a way that it deletes the record whose ID=<?php row['ID'];?>...

I guess this problem is pretty much about declaring a variable from one page and taking it into another page...

henry0

12:36 pm on Sep 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!
You could use a SESSION to carry the data from page a to page b
However “delete” scares me, have you well thought the security issue
Is the user really the user that he/she should be?
Of course no one else but authorized users may access that page
Possibly you may create a deleted table to load in the deleted rows and run a cron every other day to do a final delete; just out of thinking about possible post deleted regrets or click “ok” mistakes.

If you have a problem with setting session please, post back

BTW: what do mean by “hyperlink”
Are you thinking about passing ID via $_GET, not the best way to pass somehow secured data and even SESSIONS should be verified before using their carried value

Habtom

12:37 pm on Sep 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld

Something similar to the following should do it for you:

<a href="yourdeletepage.php?id=<?php row['ID'];?>"> Delete </a>

Habtom

henry0

1:05 pm on Sep 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In wrong hands passing ID like this could be suicidal
I'll use GET for an img id, not in a delete scenario

Habtom

5:15 am on Sep 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In wrong hands passing ID like this could be suicidal

Alright, I suspect this is going to be in his admin section or with extra layer of protection, with a certain session stored restricting the person his/her limits.

But, I understood that was what he was looking for, though I should have passed it to him with a bit of a warning.

henry0

11:39 am on Sep 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Indeed you answered well prometheus6000 quest!

I am about 2 months away from launching an alpha version of something quite huge, already a year in the making, the closer I get from that pre release the more concern (almost an obsession) I become about security.