Unable to return Post on form

I have a form on wordpress that I am trying to create on a plugin and I am trying to post it, but when I submit the form the page reloads.

if (isset( $_POST['plugin-guide-info-form-submitted'] ) ) {
            $hidden_field = esc_html ( $_POST['plugin-guide-info-form-submitted'] ) ;

            if( $hidden_field == 'Y' ) {

                $guide_name = esc_html( $_POST['wpt_guide_name'] );

                $guide_description = esc_html( $_POST['wpt_guide_description'] );

                echo $guide_name;
                echo $guide_description;

            }
        }
    }

my form is

Read More
$html .= '<form name = "plugin-guide-info" method="post" action="" enctype="multipart/form-data">' . "n";
ob_start();
                settings_fields( $this->parent->_token . '_settings' );
                do_settings_sections( $this->parent->_token . '_settings' );
                $html .= ob_get_clean();

                $html .= '<input type ="hidden" name="plugin-guide-info-form-submitted" value="Y" />' . "n";

                $html .= '<p class="submit">' . "n";
                    $html .= '<input name="plugin-guide-info-Submit" type="submit" class="button-primary" value="' . esc_attr( __( 'Save' , 'assist' ) ) . '" />' . "n";
                $html .= '</p>' . "n";
            $html .= '</form>' . "n";

settings are

private function settings_fields () {

        $settings['standard'] = array(
            'title'                 => __( '', 'assist' ),
            'description'           => __( '', 'assist' ),
            'fields'                => array(
                array(
                    'id'            => 'guide_name',
                    'name'          => 'guide_name',
                    'label'         => __( 'Guide Name' , 'assist' ),
                    'description'   => __( '', 'assist' ),
                    'type'          => 'text',
                    'default'       => '',
                    'placeholder'   => __( 'Guide Name', 'assist' )
                ),
                array(
                    'id'            => 'guide_description',
                    'name'          => 'guide_description',
                    'label'         => __( 'Guide Description' , 'assist' ),
                    'description'   => __( '', 'assist' ),
                    'type'          => 'textarea',
                    'default'       => '',
                    'placeholder'   => __( 'Plug in Description and links to tutoials', 'assist' )
                )
            )
        );

        $settings = apply_filters( $this->parent->_token . '_settings_fields', $settings );

        return $settings;
    }

I know that the name for the guide description and guide name are different wihtin the settings_fields function and the html because when I had viewed it on the developer tools it had added the wpt_ to the name-value.

I started off with using the wordpress plugin template on github

So my question is, how come I am unable to get it to post and return?

Related posts

Leave a Reply