Welcome! Log In Create A New Profile

Advanced

Delete.php confirmation sql query

Posted by Mariuspienaar 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Delete.php confirmation sql query
February 05, 2013 10:10AM
Hi there

Okay,i am at the part on my portfolio where the user must delete a record and i am stuck.

- When the user clicks on the delete link,it must take him to 'delete.php',good but it must ask the user to confirm(i guess its a question with two buttons of yes and no).Now this is where the problem comes in.

-i guess there is different ways to write your code,but i have two functions,a yes() and no(), where no() take the user back to 'Location: list_players.php'. For my yes(), my $player_id get undefined,but my $player_id works well when my player_id is outside the yes() function(i echo the $player_id and it shows the number of the record).My delete SQL works well outside any functions, it delete the record that i wanted to get deleted,but then its not asking the user to confirm,its just deleting the record.Is there another way to ask for confirmation to delete except to put it in two functions?I google this all over but cannot find anything.

Any help will be appreciated so much.thanx
avatar Re: Portfolio
February 05, 2013 11:38AM
Hi

Try using some javasctipt. Add an onclick event on the delete link that opens a confirm box asking the user if they are sure they want to complete the action. This could prevent the delete script from being run in the first place.

----------------------------------------------------------------------------------------

int get_random_number() {
return 4;
}
Re: Portfolio
February 05, 2013 04:45PM
Thanx for the tip PJ

I didnt actually want the confirmation in a popup dialog,but did it a much easier way without any functions too.I just put an if function that points to the buttons name value and call the delete script from there.The delete page is now 100%.
Sorry, only registered users may post in this forum.

Click here to login