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

(php) Delete being performed on page load instead of on submit-button click

New Here ,
Jul 06, 2009 Jul 06, 2009

I'm building a Delete Record page in PHP using Dreamweaver's server behaviors, following the instructions in the DW Help.

It's working - except the delete seems to be happening upon delete-carpet.php being loading, without the Submit button on that page being clicked.

I have a page (choose.php) which allows the user to locate the record he wants to delete. Clicking on that link is supposed to take him to the Delete page (delete-carpet.php), which I built following the directions in the DW Help.

I can see that the URL parameter is being passed, and in fact, the delete is successful. BUT, the Delete page itself, with the hidden form field and server behavior, doesn't even appear - only the "success" page that it re-directs to.

In other words, when I click the "Delete" link, which looks like this:

<a href="delete-carpet.php?carpet_id=<?php echo $row_GetCarpets['carpet_id']; ?>

I thought that I should be getting a URL like this:

delete-carpet.php?carpet_id=9

But instead, I get this:

success.php?carpet_id=9

It seems to be just performing the delete without needing the user to click the Submit button.

I've read through the directions and re-created this so many times that either I'm still missing something, or else the instructions are missing something. Any help is much appreciated.

--
Patty Ayers | www.WebDevBiz.com
Free Articles on the Business of Web Development
Web Design Contract, Estimate Request Form, Estimate Worksheet
--

TOPICS
Server side applications
657
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
Guest
Jul 06, 2009 Jul 06, 2009

In other words, when I click the "Delete" link, which looks like this:

<a href="delete-carpet.php?carpet_id=<?php echo $row_GetCarpets['carpet_id']; ?>

I think your delete link was okay, maybe there might be some mistakes on delete-carpet.php page. Okay, on that page, choose delete record (Insert > Data Objects > Delete record) and popup window will appear and choose data as below.

First check if variable is defined: Primary key value

Connection: your database

Table: the carpet table

Primary key column: carpet_id

Primary key value: URL parameter > carpet_id

After deleting go to: this one u can choose same page(choose.php) or other page except the delete-carpet.php

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 ,
Jul 07, 2009 Jul 07, 2009

Thank you, Q, but that's what I've already done.

Patty

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
Guest
Jul 07, 2009 Jul 07, 2009
LATEST

The problem is when u click at delete link, it will forward to success page? Is it? Could u post ur coding here?

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