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.
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.
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%.