Site icon Hip-Hop Website Design and Development

Kind submit from wordpress plugin

Seasoned dev, however new to wordpress development – changing into a fan in a short time.

I am knocking up my first wordpress plugin (customized contact kind for consumer, not one of the plugins can do the jazz I would like).

I can not work out easy methods to submit the shape and seize the information. Heres what I’ve bought thus far:

perform cafesignup_function() {

    $x = parse_url($_SERVER['HTTP_REFERER']);
    $pageRef = basename($x['path']);

    if(isset($_POST['submit']))
    {
        $title = $_POST['companyName'];
        $demolp_output = $title;

    } else {


    $greeetingText = "<h1>" . getTitle($pageRef) . " Quote Kind</h1>";

    $demolp_output = "<div class='mtool ccupform'></div> <div class='greeting-text'><p>" . $greeetingText . "</p></div><div class='maintext'> <div class='errortext'> </div><small>Fields with a * are required fields.</small>";
    $demolp_output .= "<kind title='quoteForm' id='quoteForm' methodology='put up' motion='/request-a-quote' >";
    $demolp_output .= "<p>Contact Identify*<br />";
    $demolp_output .= "<enter sort='textual content' class='validate bjp-contact' title='companyName' id='cafeCompanyName' worth='' dimension='40' class=''></p>";

    $demolp_output .= "<p>Enterprise title if Relevant<br />";
    $demolp_output .= "<enter sort='textual content' class='validate bjp-contact' id='cafeFirstname' worth='' dimension='40' class=''></p>";

    $demolp_output .= "<p>Phone together with STD*<br />";
    $demolp_output .= "<enter sort='textual content' class='validate bjp-contact' id='cafeSurname' worth='' dimension='40' class=''></p>";

    $demolp_output .= "<p>E mail Deal with*<br />";
    $demolp_output .= "<enter sort='textual content' class='validate vemail bjp-contact' id='cafeEmailAddress' worth='' dimension='40' class=''></p>";

    $demolp_output .= "<p> <div class='pull-right'><span onclick='clear();' id='cafeAdd2' class='btnN'>Clear</span> &NonBreakingSpace;<span onclick='addUser();' id='cafeAdd2' class='btnY'>Submit</span></middle></p>";

    $demolp_output .= "</div>";

    $demolp_output .= "</kind>";

    }

    return $demolp_output;
}

After I submit that (utilizing jquery for the submit, as under) it fires the submit, however it reveals the fro once more (additionally I can not work out what to place because the motion on the shape to reuse the plugin elsewhere).

perform addUser(){
    var emailvalidates = true;
jQuery( ".validate" ).every(perform() {
    if(jQuery(this).val() == ""){
        validates = false;
        alert("lacking fields");
    } else {
        $('#quoteForm').submit();
    }
});

}