vendredi 23 juillet 2021

How to check if checkbox is checked php

This is html code for my checkbox and button

 <input type="checkbox" id="DNA" name="DNA" value="checkox_value">
 
<button type="button" name="submit" onClick="search()" id="sim_btn" class="btn btn-primary">Start Simulation</button>

I want to check if checkbox is checked and if yes write the input to my file.
I tried using the isset function but it doesn't work any other suggestions?

if(isset($_POST["DNA"])) { 
        $input3 = "signal(f).";
        fwrite($handleStoryFile, $input3 . PHP_EOL); 
    }  



Aucun commentaire:

Enregistrer un commentaire