Home › Forums › Quform WordPress › Editing database entry error
This topic is: not resolved
- This topic has 3 replies, 2 voices, and was last updated 1 year ago by
Ally.
Viewing 4 posts - 1 through 4 (of 4 total)
- AuthorPosts
- August 9, 2023 at 11:45 pm #35871
yenfa
ParticipantHello,
So, I was trying to edit a database entry using a form. I managed to get to the part where the data is retrieved and reflected on the forms.
But when I try saving or submitting the form, a critical error happens.
I don’t want to share the URL in public, so if there’s an email I can write to, it would be great.
Thank you!
Attachments:
You must be logged in to view attached files.August 10, 2023 at 10:25 am #35877Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
August 10, 2023 at 11:57 am #35878yenfa
ParticipantHello Ally! Thank you for your assistance.
I’ve tried to check my code but I don’t know anymore what’s wrong.
add_filter('quform_post_process_2', function (array $result, Quform_Form $form) { global $wpdb; $table = 'wp9v_3_ked_fanlist_members'; // The data to save/update $data = array( 'name' => $form->getValue('quform_2_3'), 'email' => $form->getValue('quform_2_11'), 'website' => $form->getValue('quform_2_5'), 'country' => $form->getValue('quform_2_8'), 'code' => $form->getValue('quform_2_6'), 'hide_email' => $form->getValue('quform_2_7') ); $rowId = string($form->getValue('quform_2_11')); if ($rowId > 0) { $wpdb->update($table, $data, array('email' => $rowId)); } else { $wpdb->insert($table, $data); } return $result; }, 10, 2); // update form add_action('quform_pre_display_2', function (Quform_Form $form) { if (!isset($_GET['e'])) { return; } global $wpdb; $rowId = (string)$_GET['e']; $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM wp9v_3_ked_fanlist_members WHERE email = %s', $rowId), ARRAY_A); if (!is_array($row)) { return $row['ID']; } // The form values to set // $data = array( 'quform_2_3' => $row['name'], 'quform_2_11' => $row['email'], 'quform_2_5' => $row['website'], 'quform_2_8' => $row['country'], 'quform_2_6' => $row['code'], 'quform_2_7' => $row['hide_email']); $form->setValues($data); });
August 11, 2023 at 9:12 am #35881Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.