Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP Goto Detail link

Explorer ,
Aug 21, 2009 Aug 21, 2009

I've built a PHP version of the Goto Detail Page link that goes to a mySQL/PHP DELETE records page.. but when I click on the link to go to that page (where it retrieves the record in a PHP recordset to get confirmation before deleting), instead the originating page just executes the delete (it looks like) and reloads minus the newly deleted file. I need to click on this link, go to the confirmation page so that they can decide for sure that they want to delete it, and click the submit button for the page to execute the Delete behavior.

Why?  The code piece linking to the confirmation pages is:

<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>">Delete</a>

Help?

TOPICS
Server side applications
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2009 Aug 25, 2009

Hello Adrian

Why go to a confirmation page?  You can accomplish this with less code, just use javascript. I have provided the code below:

Place this code in the head section of your PHP page

<script type="text/javascript">
     function ConfirmDelete(){
         var confDel = confirm("Are you sure you want to delete this record?")
         return confDel
     }
</script>

Now change your link from

This:

<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>">Delete</a>

to This:

<a href="del_entry.php?UID=<?php echo $row_Recordset1['UID']; ?>" title="Delete" onClick='return ConfirmDelete()'"; >Delete</a>

Notice the code in BOLD. This will call up an alert box that will display the ConfirmDelete text and allow the user to either go ahead and delete the record or cancel.

Hope this helps
Stan Forrest
Digital Magic Show

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 09, 2009 Sep 09, 2009
LATEST

This is great Stan, and it works, the redirect afterwards goes to the target page, but adds on the unique ID string, screwing with that target page.. for example, it goes to:

http://www.domain.org/memberAdmin.php?entrynumber=1447

and I need to to just go to:

http://www.domain.org/memberAdmin.php

How can I tweak the DW code so I don't get the added URL stuff?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines