close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

"Undefined Index" error with insert multiple records behavior

Thread begun 2/28/2019 9:41 am by Justin@AdventDesign | Last modified 3/01/2019 9:08 am by Ray Borduin | 867 views | 5 replies |

Justin@AdventDesign

"Undefined Index" error with insert multiple records behavior

Attempting to manage relational tables following the tutorial http://www.webassist.com/community/tutorials/view_tutorial.php?tid=25&accesscheck=/community/tutorials/view_tutorial.php?tid%3D25 - I'm aware this tutorial was written for MySQL rather than MySQLi, but It's my understanding the basic process is the same.

- I've eliminated the redirect on the existing insert behavior
- I've pulled the options table (tbl_homes) information and repeated it with the 'id' column properly inserted in the checkbox field
- I've tried to apply the insert multiple records behavior

I've tried tearing down and rebuilding several times, but I keep running into the same consistent error:
"Notice: Undefined index: wamultiinsert_1 in /Applications/XAMPP/xamppfiles/htdocs/sites/abm-sites/team-construction/sitecontrol/tbl_images_insert.php on line 29"

Page attached.

Sign in to reply to this post

Ray BorduinWebAssist

You have your trigger set to "always" for the multiple insert. It needs to be set to the button press for the submit button like the first insert.

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

Justin@AdventDesign

:facepalm:

Sorry about that. I thought I had experimented with that but must have missed it.

After making sure the insert multiple records function comes after the original insert, I’m still having a bit of trouble getting it to submit the proper binding values. The tutorial says for the ’item’ id choose the session variable for the insert. In my case that would be WADA_Insert_tbl_images. For the ‘option’ id, choose the form item. It appears I have the options of wamultiinsert_1[] (csv) and wamultiinsert_1[] (array). I’ve tried both.

However, rather than only submitting the checked item ids, the records it set just repeat the same option id that is the first in the list of records (in my case ‘home_id’) for 5 (the total number of results of the rsHomes) times. I’m guessing I’m missing something simple, but I can’t seem to find the step I missed here.

Sign in to reply to this post

Justin@AdventDesign

Found the skip if empty... which has stopped the repetition, but no matter what I select, I can't seem to find the right variable for the option table id (tbl_homes) repeated from the rsHomes recordset. It just repeats null or 0. Any direction on what I'm looking for?

<?php
if (isset($_POST["Insert"]) || isset($_POST["Insert_x"])) {
$MultipleInsertConnection = $framework_connect;
$MultipleInsertTable = "rel_images";
$MultipleInsertRedirect = "tbl_images_results.php";
$MultipleInsertCheck = "rel_homes";
$MultipleInsertIdentifier = 'wamultiinsert_1';
for ($mi=0; $mi<sizeof($_POST[$MultipleInsertIdentifier]); $mi++) {
$MultipleInsertCount = $_POST[$MultipleInsertIdentifier][$mi];
if (($MultipleInsertCheck == "" || (isset($_POST[$MultipleInsertCheck.'_'.$MultipleInsertCount]) && $_POST[$MultipleInsertCheck.'_'.$MultipleInsertCount]!=""))) {
$InsertQuery = new WA_MySQLi_Query($MultipleInsertConnection);
$InsertQuery->Action = "insert";
$InsertQuery->Table = $MultipleInsertTable;
$InsertQuery->bindColumn("home_id", "i", "".((isset($_POST["wamultiinsert_1"."_".$MultipleInsertCount]))?$_POST["wamultiinsert_1"."_".$MultipleInsertCount]:"") ."", "WA_IGNORE");
$InsertQuery->bindColumn("image_id", "i", "".$_SESSION['WADA_Insert_tbl_images'] ."", "WA_IGNORE");
$InsertQuery->execute();
}
}
if ($MultipleInsertRedirect) {
if (function_exists("rel2abs")) $MultipleInsertRedirect = rel2abs($MultipleInsertRedirect,dirname(__FILE__));
header("location: " . $MultipleInsertRedirect);
}
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

When it says:

" For the ‘option’ id, choose the form item."

It means to select it from the dropdown list... not using the lightning bolt and bindings that appear there. The values you are selecting are not the correct ones. The correct ones should be select-able from the list.

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

Justin@AdventDesign

The instructions mentioning clicking on the 'lightening bolt' so that was what was throwing me. This appears to work now. Thanks!

Sign in to reply to this post

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