Programming a HTML userinterface for milight/limitlessled PHP script

I am fairly new with programming and I need some help with my second project of programming a userinterface.

I'm trying to build an HTML userinterface for using this php script: Stackoverflow question 42535502 which is used to send UDP packets to milight ledlights.

First project:

For my first project I have already build a userinterface for sending UDP packets to a KAKU receiver on my network. Here is how my first script looks, and that's working fine:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head 
content must come *after* these tags -->
    <title>Home Automation</title>

    <!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body{
    background-image: url("image/wood_dark_up.jpg") ;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    height:100%;
}
</style>
  </head>
  <body>
  <div class="container-fluid">
        <div class="row">
            <div class="col-xs-12">
                <form class="form-horizontal" role="form" method="post" action="index.php">
                <div class="form-group">
                    </br>
                </div>
                <div class="form-group">
                    <label for="tuin" class="col-xs-6 col-sm-5 col-md-4 col-lg-2 control-label text-warning"><h4><strong>Tuinverlichting</strong></h4></label>
                    <div class="col-xs-6 col-sm-7 col-md-8 col-lg-10 btn-group">
                        <input type="submit" name="tuin_on" id="tuin_on" value="ON" class="btn btn-success active btn-md">
                        <input type="submit" name="tuin_off" id="tuin_off" value="OFF" class="btn btn-danger active btn-md">
                    </div>
                </div>
                <div class="form-group">
                    <label for="cam" class="col-xs-6 col-sm-5 col-md-4 col-lg-2 control-label text-warning"><h4><strong>Camera</strong></h4></label>
                    <div class="col-xs-6 col-sm-7 col-md-8 col-lg-10 btn-group">
                        <input type="submit" name="cam_on" id="cam_on" value="ON" class="btn btn-success active btn-md">
                        <input type="submit" name="cam_off" id="cam_off" value="OFF" class="btn btn-danger active btn-md">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as 
needed -->
<script src="js/bootstrap.min.js"></script>
  </body>
</html>

<?php
    $msg = "";

    if (isset($_POST["tuin_on"])) {
        $msg = "100,!R1D1F1|Woonkamer|Tuin verlichting AAN";
    }
    if (isset($_POST["tuin_off"])) {
        $msg = "101,!R1D1F0|Woonkamer|Tuin verlichting UIT";
    }
    if (isset($_POST["cam_on"])) {
        $msg = "100,!R1D2F1|Woonkamer|Camera woonkamer AAN";
    }
    if (isset($_POST["cam_off"])) {
        $msg = "102,!R1D2F0|Woonkamer|Camera woonkamer UIT";
    }

    $fp = fsockopen("udp://192.168.1.255", 9760, $errno, $errstr);

    if ($fp) {
        fwrite($fp, $msg);
        fclose($fp);
        //echo("$msg");
    }
    else {
    echo("ERROR: $errno - $errstr\n");
    }

?>

Second project

With my second project I'm hitting a wall...

The php script used here is very complicated and hard for me to understand, so I would realy appreciate some help and a push in te right direction.

Greetings from the Netherlands, Bob.