update into custom database

Home Forums Quform WordPress update into custom database

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  kunstbada 1 week, 1 day ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23286

    kunstbada
    Participant

    Hello,

    I’d like make a form which can update custom database table from Quform if you add new text.
    It seems like this manual but it doesn’t work in my case.

    I want to share the first name from wp current user name with quform.
    Here is my code.
    Can you tell me what should I do? What is wrong about this code?

    Best regards

    Yoon

    
    function my_load_form_data(iPhorm $form)
    {
        if (!isset($_GET['edit'])) {
            return;
        }
     
        global $wpdb;
        $rowId = absint($_GET['edit']);
     
        $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM hddt_usermeta WHERE id = %d', $rowId), ARRAY_A);
     
        if (!is_array($row)) {
            return;
        }
     
        // The form values to set
        $data = array(
            '1_20' => $row['first_name'],
           /* 'iphorm_1_2' => $row['email'],
            'iphorm_1_3' => $row['phone'],
            'iphorm_1_4' => maybe_unserialize($row['checkbox']),*/
            '1_22' => $rowId 
        );
     
        $form->setValues($data);
    }
    add_action('iphorm_pre_display_1', 'my_load_form_data');
    
    
    • This topic was modified 2 weeks, 1 day ago by  kunstbada.
    • This topic was modified 2 weeks, 1 day ago by  kunstbada.
    • This topic was modified 2 weeks, 1 day ago by  kunstbada.
    Attachments:
    You must be logged in to view attached files.
    #23359

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #23388

    kunstbada
    Participant

    Thank you very much.
    It’s working well. 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.