close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Delete multiple database fields with single checkbox

Thread began 8/02/2011 11:36 am by webVoodoo | Last modified 8/02/2011 8:12 pm by webVoodoo | 2342 views | 3 replies

webVoodoo

Oh, oh, oh, think I've figured this one out. As all the update action takes place in the Update Record. I dived in there and modified the code. I'll post it here as this may be of help to others.

My delete checkbox is:

<input type="checkbox" name="chk_1" value="delete" />

Modified update record code (being careful) from:

|" . "".((isset($_POST["title_1"]))?$_POST["title_1"]:"") ."" . "|

To:

|" . "".((($_POST["chk_1"] != "delete"))&&(isset($_POST["title_1"]))?$_POST["title_1"]:"") ."" . "|

...and what do you know, it seems to work !!
So only if the checkbox is ticked is the 'title' entry deleted from the database field.

The code below was found on this good forum posted by Jason. I'll paraphrase here.

When it comes to deleting the file's name from the database (using the same checkbox):

The modification is made to the line 'DefaultFileName... and don't forget the correct path to your files folder in 'UploadFolder''

$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../uploads/",
'FileName' => "[FileName]",
'DefaultFileName' => "".((($_POST["chk_1"] != "delete"))?$_POST["file_1"]:"") ."",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>

To delete the actual file from the server, add this for each checkbox:

<?php
$WA_DeleteFileResult1 = false;
if((((isset($_POST["chk_1"]))?$_POST["chk_1"]:"") != "")){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../uploads/", "".((isset($_POST["file_1"]))?$_POST["file_1"]:"") ."");
}?>

I just repeated this for all the other files/titles on the page with checkboxes chk_2, chk_3, etc.

I've only just got this working and need to test thoroughly... but so far, so good.

Paul

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...