Shortcode display outside the div

Use this instead:

Concatenate the html then return it.

function check_my_login( $atts)
{

    $html="<form action="" name="" method="post" enctype="multipart/form-data">";
    $html .= '<div class="form-group">';
    $html .= '<label for="description">Project Description</label>';
    $html .= '<textarea name="p_description" placeholder="Project Description" class="form-control">';

    if(isset($_POST['p_description']) && $_POST['p_description'] != ''){
        $html .= $_POST['p_description'];
    }

    $html .= '</textarea>';
    $html .= '</div>';
    $html .= '<div class="form-group">';
    $html .= '<label>Project Attachment</label>';
    $html .= '<input type="file" name="p_attachment">';
    $html .= '</div>';
    $html .= '</form>';

    return $html;
}

 add_shortcode( 'kentaUser', 'check_my_login' );

Leave a Comment