Skip to main content
Known Participant
July 6, 2009
Question

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

  • July 6, 2009
  • 1 reply
  • 657 views

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

This topic has been closed for replies.

1 reply

July 7, 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

P_18Author
Known Participant
July 7, 2009

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

Patty

July 8, 2009

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