Code Snippets

$codes = array() ;
foreach ( $icd_codes as $val )  {
    if ( trim($val[0]) != '' ) {
    #   $codes[] = $val[0] ;

        if ( !array_key_exists($val[0], $codes) ) {

            $codes[$val[0]] = $val[1] ;
            echo '<tr>' ;
            echo '<td>' . $val[0] . '</td>' ;
            echo '<td>' . $val[1] . '</td>' ;
            echo '<td>' . '<input type="checkbox" name="H'. $val[0] . '">'    . '</td>' ;
            echo '<td>' . '<input type="checkbox" name="N'. $val[0] . '">'    . '</td>' ;
            echo '<td>' . '<input type="checkbox" name="E'. $val[0] . '">'    . '</td>' ;
            echo '</tr>' ;
        }
    }
}
<button onclick="d_send();">SEND</button>
<div id="diagresult">remote</div><br />
<div id="results">fields</div>
function showValues() {
    var fields = $("#diagnoses").serializeArray();
    $( "#results" ).empty();
    jQuery.each( fields, function( i, field ) {
    $( "#results" ).append( field.name + field.value + " " );
    });
}

$( ":checkbox" ).click( showValues );

function d_send() {
    var s = $("#diagnoses").serialize();
    $("#diagresult").html(s);
}

function showValues() {
    $('#diagnoses :checkbox').prop('checked', false);
    $("input[name='"+this.name+"']").prop('checked', true);
};

$( ":checkbox" ).click( showValues );

function d_send() {
    var s = $("#diagnoses").serialize();

    //  validate

    $("#results").load('/remote/diagnoses/ssp/responder.php', {
        'main' : s,
        'side' : 'side codes'
    });
};

TITLE: Code Snippets
DATE: 2017-12-04
UPDATE:
AUTHOR: jRu
SOURCE:
TAGS:
javascript jquery php