close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Managing Relational Database - update page problem

Thread began 4/04/2021 9:53 am by MagsW | Last modified 4/06/2021 9:05 am by Ray Borduin | 21 views | 4 replies |

MagsW

Managing Relational Database - update page problem

Hi Ray, I've added a new relational table to a database and consequently need to update the insert and update record pages. I've managed to do the insert page using new checkboxes populated from a recordset and an "Insert Multiple Records" behavior which writes the values to one of the new tables. All works fine. However, the update existing record page has got me stumped!

I've added the same checkboxes to the update page, populated via a recordset, and then used the Manage Relational Table behavior to write the primary ID from the record, along with the values from the selected checkboxes, to the new table. It's only writing the first checkbox value though, so how do I get it to add multiple checkbox values? Do I need to combine the Manage Relational Database with Update Multiple Records? I've attached a copy of the update page for reference, along with the insert page which writes everything correctly.

Sign in to reply to this post

Ray BorduinWebAssist

Try renaming your checkbox to Filter[]. Without the square brackets, only one value will be submitted.

Sign in to reply to this post
Did this help? Tips are appreciated...

MagsW

That fixed it, thanks! The only other thing I need to do is prepopulate the checkboxes on the update page if there are already values saved for that LenderID. At the moment the repeating checkbox value is <?php echo($rsFilters->getColumnVal("FilterID")); ?> how would I change this so that it will prepopulate if a value already exists, but will also pass a new value if it doesn't already exist?

Sign in to reply to this post

MagsW

I had a fiddle with it to see if I could work it out - and I did!

I added a recordset to get all entries in the relational table with that LenderID:

<?php
$rsCategories = new WA_MySQLi_RS("rsCategories",$Exclusives_i,1);
$rsCategories->setQuery("SELECT * FROM LenderCategories WHERE LenderCategories.LenderID = ?");
$rsCategories->bindParam("i", "".$_GET["LenderID"] ."", "-1"); //paramLender
$rsCategories->execute();
?>

then coded the checkbox like this:

<input type="checkbox" id="Filter" name="Filter[]" value="<?php echo($rsFilters->getColumnVal("FilterID")); ?>" <?php
$wa_startindex = 0;
while(!$rsCategories->atEnd()) {
$wa_startindex = $rsCategories->Index;
?><?php if ($rsCategories->getColumnVal("FilterID") == $rsFilters->getColumnVal("FilterID")) { // Show if ?>
checked <?php } // Show if ?><?php
$rsCategories->moveNext();
}
$rsCategories->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?> />

Sorted!

Sign in to reply to this post

Ray BorduinWebAssist

Nicely done. Thanks for the update

Sign in to reply to this post
Did this help? Tips are appreciated...

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