<?php

include('include/headscript.php'); ?>

<?php

// pickup the get variable

$formname = "nocontact";

if (isset($_POST["idtrf"])) {

    $idtrf = $_POST["idtrf"];

}

if (isset($_GET["idtrf"])) {

    $idtrf = $_GET["idtrf"];

}

if (isset($_GET["formname"])) {

    $formname = $_GET["formname"];

}

if (isset($_POST["formname"])) {

    $formname = $_POST["formname"];

}

if (isset($_GET["kindcontacts"])) {

    $kindcontacts = $_GET["kindcontacts"];

}

if (isset($_POST["kindcontacts"])) {

    $kindcontacts = $_POST["kindcontacts"];

}

if (isset($_GET["idauditdpi"])) {

    $idauditdpi = $_GET["idauditdpi"];

}

if (isset($_POST["idauditdpi"])) {

    $idauditdpi = $_POST["idauditdpi"];

}

if (isset($_GET["idcontacts"])) {

    $idcontacts = $_GET["idcontacts"];

}

if (isset($_POST["idcontacts"])) {

    $idcontacts = $_POST["idcontacts"];

}

if (isset($_GET["kindcontactscopy"])) {

    $kindcontactscopy = $_GET["kindcontactscopy"];

}

if (isset($_POST["kindcontactscopy"])) {

    $kindcontactscopy = $_POST["kindcontactscopy"];

}

?>

<?php

$countrylist = new WA_MySQLi_RS("countrylist", $cmctrfdb, 0);

$countrylist->setQuery("SELECT * FROM countries ORDER BY countries.namecountry");

$countrylist->execute();

?>

<?php  //edit contact search engine

if ($formname == "searchnamedet") {







    if (isset($_GET["companynamevalue"])) {

        $compname = $_GET["companynamevalue"];

    }



    $companyid = 0;



    $searchctdetail = new WA_MySQLi_RS("searchctdetail", $cmctrfdb, 1);

    $searchctdetail->setQuery("SELECT * FROM contacts WHERE contacts.companyname='$compname'");

    $searchctdetail->execute();



    if (!empty($searchctdetail->getColumnVal("companyname"))) {

        $companynamet = $searchctdetail->getColumnVal("companyname");

    } else {

        $companynamet = "";

    }

    if (!empty($searchctdetail->getColumnVal("piva"))) {

        $piva = $searchctdetail->getColumnVal("piva");

    } else {

        $piva = "";

    }

    if (!empty($searchctdetail->getColumnVal("address"))) {

        $address = $searchctdetail->getColumnVal("address");

    } else {

        $address = "";

    }

    if (!empty($searchctdetail->getColumnVal("city"))) {

        $city = $searchctdetail->getColumnVal("city");

    } else {

        $city = "";

    }

    if (!empty($searchctdetail->getColumnVal("cap"))) {

        $cap = $searchctdetail->getColumnVal("cap");

    } else {

        $cap = "";

    }

    if (!empty($searchctdetail->getColumnVal("country"))) {

        $country = $searchctdetail->getColumnVal("country");

    } else {

        $country = "";

    }

    if (!empty($searchctdetail->getColumnVal("telephone"))) {

        $telephone = $searchctdetail->getColumnVal("telephone");

    } else {

        $telephone = "";

    }

    if (!empty($searchctdetail->getColumnVal("email"))) {

        $email = $searchctdetail->getColumnVal("email");

    } else {

        $email = "";

    }

    if (!empty($searchctdetail->getColumnVal("contactname"))) {

        $contactname = $searchctdetail->getColumnVal("contactname");

    } else {

        $contactname = "";

    }

    if (!empty($searchctdetail->getColumnVal("contactsurname"))) {

        $contactsurname = $searchctdetail->getColumnVal("contactsurname");

    } else {

        $contactsurname = "";

    }



    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";

    $UpdateQuery->bindColumn("companyname", "s", "$companynamet", "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", "$address", "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", "$contactsurname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("companyid", "i", "$companyid", "WA_DEFAULT");

    $UpdateQuery->addFilter("idcontacts", "=", "i", "" . ($idcontacts)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}

?>

<?php  //edit contact details

if ($formname == "editcontactsdetails") {







    if (isset($_POST["companyname"])) {

        $companynamet = $_POST["companyname"];

    } else {

        $companynamet = "";

    }

    if (isset($_POST["piva"])) {

        $piva = $_POST["piva"];

    } else {

        $piva = "";

    }

    if (isset($_POST["companyaddress"])) {

        $address = $_POST["companyaddress"];

    } else {

        $address = "";

    }

    if (isset($_POST["city"])) {

        $city = $_POST["city"];

    } else {

        $city = "";

    }

    if (isset($_POST["cap"])) {

        $cap = $_POST["cap"];

    } else {

        $cap = "";

    }

    if (isset($_POST["country"])) {

        $country = $_POST["country"];

    } else {

        $country = "";

    }

    if (isset($_POST["telephone"])) {

        $telephone = $_POST["telephone"];

    } else {

        $telephone = "";

    }

    if (isset($_POST["email"])) {

        $email = $_POST["email"];

    } else {

        $email = "";

    }

    if (isset($_POST["contactname"])) {

        $contactname = $_POST["contactname"];

    } else {

        $contactname = "";

    }

    if (isset($_POST["contactsurname"])) {

        $contactsurname = $_POST["contactsurname"];

    } else {

        $contactsurname = "";

    }

    $companyid = 0;







    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";

    $UpdateQuery->bindColumn("companyname", "s", "$companynamet", "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", "$address", "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", "$contactsurname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("companyid", "i", "$companyid", "WA_DEFAULT");

    $UpdateQuery->addFilter("idcontacts", "=", "i", "" . ($idcontacts)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}

?>



<?php  //copy mycompany

if ($formname == "copymycompany") {



    $contactsdet = new WA_MySQLi_RS("contactsdet", $cmctrfdb, 1);

    $contactsdet->setQuery("SELECT * FROM company WHERE company.idcompany='$idcompany'");

    $contactsdet->execute();



    if (!is_null($contactsdet->getColumnVal("companyname_company"))) {

        $companynamet = $contactsdet->getColumnVal("companyname_company");

    } else {

        $companynamet = "";

    }

    if (!is_null($contactsdet->getColumnVal("piva_company"))) {

        $piva = $contactsdet->getColumnVal("piva_company");

    } else {

        $piva = "";

    }

    if (!is_null($contactsdet->getColumnVal("address_company"))) {

        $address = $contactsdet->getColumnVal("address_company");

    } else {

        $address = "";

    }

    if (!is_null($contactsdet->getColumnVal("city_company"))) {

        $city = $contactsdet->getColumnVal("city_company");

    } else {

        $city = "";

    }

    if (!is_null($contactsdet->getColumnVal("zip_company"))) {

        $cap = $contactsdet->getColumnVal("zip_company");

    } else {

        $cap = "";

    }

    if (!is_null($contactsdet->getColumnVal("country_company"))) {

        $country = $contactsdet->getColumnVal("country_company");

    } else {

        $country = "";

    }

    if (!is_null($contactsdet->getColumnVal("telephone_company"))) {

        $telephone = $contactsdet->getColumnVal("telephone_company");

    } else {

        $telephone = "";

    }

    if (!is_null($contactsdet->getColumnVal("email_company"))) {

        $email = $contactsdet->getColumnVal("email_company");

    } else {

        $email = "";

    }

    if (!is_null($contactsdet->getColumnVal("maincontactname_company"))) {

        $contactname = $contactsdet->getColumnVal("maincontactname_company");

    } else {

        $contactname = "";

    }

    if (!is_null($contactsdet->getColumnVal("maincontactsurname_company"))) {

        $contactsurname = $contactsdet->getColumnVal("maincontactsurname_company");

    } else {

        $contactsurname = "";

    }

    if (!is_null($idcompany)) {

        $companyid = $idcompany;

    } else {

        $companyid = "";

    }





    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";

    $UpdateQuery->bindColumn("companyname", "s", "$companynamet", "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", "$address", "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", "$contactsurname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("companyid", "i", "$companyid", "WA_DEFAULT");

    $UpdateQuery->addFilter("idcontacts", "=", "i", "" . ($idcontacts)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}

?>



<?php  //copy contacts

if ($formname == "copycontacts") {



    $contactsdet = new WA_MySQLi_RS("contactsdet", $cmctrfdb, 1);

    $contactsdet->setQuery("SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts='$kindcontactscopy'");

    $contactsdet->execute();



    if (!is_null($contactsdet->getColumnVal("companyname"))) {

        $companynamet = $contactsdet->getColumnVal("companyname");

    } else {

        $companynamet = "";

    }

    if (!is_null($contactsdet->getColumnVal("piva"))) {

        $piva = $contactsdet->getColumnVal("piva");

    } else {

        $piva = "";

    }

    if (!is_null($contactsdet->getColumnVal("address"))) {

        $address = $contactsdet->getColumnVal("address");

    } else {

        $address = "";

    }

    if (!is_null($contactsdet->getColumnVal("city"))) {

        $city = $contactsdet->getColumnVal("city");

    } else {

        $city = "";

    }

    if (!is_null($contactsdet->getColumnVal("cap"))) {

        $cap = $contactsdet->getColumnVal("cap");

    } else {

        $cap = "";

    }

    if (!is_null($contactsdet->getColumnVal("country"))) {

        $country = $contactsdet->getColumnVal("country");

    } else {

        $country = "";

    }

    if (!is_null($contactsdet->getColumnVal("telephone"))) {

        $telephone = $contactsdet->getColumnVal("telephone");

    } else {

        $telephone = "";

    }

    if (!is_null($contactsdet->getColumnVal("email"))) {

        $email = $contactsdet->getColumnVal("email");

    } else {

        $email = "";

    }

    if (!is_null($contactsdet->getColumnVal("contactname"))) {

        $contactname = $contactsdet->getColumnVal("contactname");

    } else {

        $contactname = "";

    }

    if (!is_null($contactsdet->getColumnVal("contactsurname"))) {

        $contactsurname = $contactsdet->getColumnVal("contactsurname");

    } else {

        $contactsurname = "";

    }

    $companyid = 0;



    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "contacts";

    $UpdateQuery->bindColumn("companyname", "s", "$companynamet", "WA_DEFAULT");

    $UpdateQuery->bindColumn("piva", "s", "$piva", "WA_DEFAULT");

    $UpdateQuery->bindColumn("address", "s", "$address", "WA_DEFAULT");

    $UpdateQuery->bindColumn("city", "s", "$city", "WA_DEFAULT");

    $UpdateQuery->bindColumn("cap", "s", "$cap", "WA_DEFAULT");

    $UpdateQuery->bindColumn("country", "s", "$country", "WA_DEFAULT");

    $UpdateQuery->bindColumn("telephone", "s", "$telephone", "WA_DEFAULT");

    $UpdateQuery->bindColumn("email", "s", "$email", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactname", "s", "$contactname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("contactsurname", "s", "$contactsurname", "WA_DEFAULT");

    $UpdateQuery->bindColumn("companyid", "i", "$companyid", "WA_DEFAULT");

    $UpdateQuery->addFilter("idcontacts", "=", "i", "" . ($idcontacts)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}



if ($kindcontacts == "certificatetotest") {



    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "`trf-details`";

    $UpdateQuery->bindColumn("certotherclient", "s", "Y", "WA_DEFAULT");

    $UpdateQuery->addFilter("idtrfdetails", "=", "i", "" . ($idtrf)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo);

}

?>

<?php

$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 0);

$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");

$trfnumberfinal->execute();

?>

<?php

$idcertn = $trfnumberfinal->getColumnVal("idcertification");

$idcert = $trfnumberfinal->getColumnVal("idcertification");

?>

<?php

$certname = new WA_MySQLi_RS("certname", $cmctrfdb, 1);

$certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");

$certname->execute();

?>



<?php

$contactdatacheck = new WA_MySQLi_RS("contactdatacheck", $cmctrfdb, 0);

$contactdatacheck->setQuery("SELECT * FROM contacts WHERE contacts.idtrf='$idtrf'");

$contactdatacheck->execute();

$contactlist = array();

?>

<?php

$wa_startindex = 0;

while (!$contactdatacheck->atEnd()) {

    $wa_startindex = $contactdatacheck->Index;

?>

    <?php

    $contactlist[] = $contactdatacheck->getColumnVal("kindofcontacts");



    ?>

<?php

    $contactdatacheck->moveNext();

}

$contactdatacheck->moveFirst(); //return RS to first record

unset($wa_startindex);

unset($wa_repeatcount);



?>







<!DOCTYPE html>

<html lang="en">



<head>

    <meta charset="utf-8" />

    <title>TRF CIMAC </title>

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta content="CIMAC TRF Portal" name="description" />

    <meta content="" name="author" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />



    <!-- App favicon -->

    <link rel="shortcut icon" href="../images/favicon.ico">



    <!--Form Wizard-->

    <link href="../plugins/jquery-steps/jquery.steps.css" rel="stylesheet" type="text/css">



    <!-- App css -->

    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

    <link href="assets/css/jquery-ui.min.css" rel="stylesheet">

    <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />

    <link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />

    <link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />





    <!-- submit form with button -->

    <script>

        function formSubmit() {

            document.forms["myForm"].submit();

        }

    </script>

    <!-- upload image script -->





    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <script type='text/javascript'>

        window.onunload = function() {

            window.opener.location.reload();

        }

    </script>



    <!-- search on article -->

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

    <script type="text/javascript" src="searchengine/scriptsearchcontact.js"></script>

    <!-- submit form with button -->

</head>



<body>







    <!-- section file already uploaded -->



    <div class="card">

        <div class="card-body">

            <h4 class="mt-0 header-title">CONTACT FORM</h4>

            <?php echo $copycontactfrom; ?>

            <?php include('include/querycontacts.php'); ?>

            <?php if ($compid < 1) { ?>

                <a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=mycompany&idtrf=<?php echo $idtrf; ?>&formname=copymycompany&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficamycompany; ?></button> </a> <?php } ?>

            <?php if ($kindcontacts != "audit") { ?><?php if (in_array('audit', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=audit&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficaaudit; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                            } ?>

    <?php if ($kindcontacts != "headertest") { ?><?php if (in_array('headertest', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=headertest&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficatest; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                                } ?>

<?php if ($kindcontacts != "headercertificate") { ?><?php if (in_array('headercertificate', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=headercertificate&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficacertificate; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                                                        } ?>

<?php if ($kindcontacts != "invoice") { ?><?php if (in_array('invoice', $contactlist)) { ?><a href="contactpop.php?idcontacts=<?php echo ($contactdata->getColumnVal("idcontacts")); ?>&kindcontactscopy=invoice&idtrf=<?php echo $idtrf; ?>&formname=copycontacts&kindcontacts=<?php echo $kindcontacts; ?>"><button type="button" class="btn btn-outline-secondary waves-effect"><?php echo $anagraficainvoice; ?></button></a><?php }

                                                                                                                                                                                                                                                                                                                                                                                                                        } ?>

<br><br>



<form class="needs-validation" id="editcontacts" name="editcontacts" action="#" method="POST" novalidate="">

    <div class="form-row">



        <div class="col-md-4 mb-3">

            <label for="companyname"><?php echo $companynametitle; ?></label>

            <input type="text" class="form-control" id="companyname" name="companyname" value="<?php echo ($contactdata->getColumnVal("companyname")); ?>" placeholder="<?php echo $companynametitle; ?>" required>

        </div>

        <div class="col-md-5 mb-3">

            <label for="companyaddress"><?php echo $companyaddresstitle; ?></label>

            <input type="text" class="form-control" id="companyaddress" name="companyaddress" value="<?php echo ($contactdata->getColumnVal("address")); ?>" placeholder="<?php echo $companyaddresstitle; ?>" required="">

        </div>

        <div class="col-md-3 mb-3">

            <label for="piva"><?php echo $pivatitle; ?></label>

            <div class="input-group">

                <input type="text" class="form-control" id="piva" name="piva" value="<?php echo ($contactdata->getColumnVal("piva")); ?>" placeholder="<?php echo $pivatitle; ?>" aria-describedby="inputGroupPrepend3" required="">

            </div>

        </div>

    </div>

    <div class="form-row">

        <div class="col-md-5 mb-3">

            <label for="city"><?php echo $citytitle; ?></label>

            <input type="text" class="form-control" id="city" name="city" value="<?php echo ($contactdata->getColumnVal("city")); ?>" placeholder="<?php echo $citytitle; ?>" required="">

        </div>

        <div class="col-md-4 mb-3">

            <label for="country"><?php echo $countrytitle; ?></label>





            <select class="form-control" id="country" name="country">



                <?php

                while (!$countrylist->atEnd()) { //dyn select

                ?>

                    <option value="<?php echo ($countrylist->getColumnVal("idcountries")); ?>" <?php if (!(strcmp($countrylist->getColumnVal("idcountries"), ($contactdata->getColumnVal("country"))))) {

                                                                                                    echo "selected=\"selected\"";

                                                                                                } ?>><?php echo ($countrylist->getColumnVal("namecountry")); ?></option>

                <?php

                    $countrylist->moveNext();

                } //dyn select

                $countrylist->moveFirst();

                ?>

            </select>







        </div>

        <div class="col-md-3 mb-3">

            <label for="cap"><?php echo $captitle; ?></label>

            <div class="input-group">

                <input type="text" class="form-control" id="cap" name="cap" value="<?php echo ($contactdata->getColumnVal("cap")); ?>" placeholder="<?php echo $captitle; ?>" aria-describedby="inputGroupPrepend3" required="">

            </div>

        </div>

    </div>

    <div class="form-row">

        <div class="col-md-3 mb-3">

            <label for="telephone"><?php echo $telephonetitle; ?></label>

            <input type="text" class="form-control" id="telephone" name="telephone" value="<?php echo ($contactdata->getColumnVal("telephone")); ?>" placeholder="<?php echo $telephonetitle; ?>" required="">

        </div>

        <div class="col-md-3 mb-3">

            <label for="email"><?php echo $emailtitle; ?></label>

            <input type="text" class="form-control" id="email" name="email" value="<?php echo ($contactdata->getColumnVal("email")); ?>" placeholder="<?php echo $emailtitle; ?>" required="">

        </div>

        <div class="col-md-3 mb-3">

            <label for="contactname"><?php echo $contactnametitle; ?></label>

            <div class="input-group">

                <input type="text" class="form-control" id="contactname" value="<?php echo ($contactdata->getColumnVal("contactname")); ?>" name="contactname" placeholder="<?php echo $contactnametitle; ?>" aria-describedby="inputGroupPrepend3" required="">

            </div>

        </div>

        <div class="col-md-3 mb-3">

            <label for="contactsurname"><?php echo $contactsurnametitle; ?></label>

            <div class="input-group">

                <input type="text" class="form-control" id="contactsurname" name="contactsurname" value="<?php echo ($contactdata->getColumnVal("contactsurname")); ?>" placeholder="<?php echo $contactsurnametitle; ?>" aria-describedby="inputGroupPrepend3" required="">

            </div>

        </div>



        <input type="hidden" id="tempcode" name="tempcode" value="<?php echo $tempcode; ?>">

        <input type="hidden" id="kindcontacts" name="kindcontacts" value="<?php echo ($contactdata->getColumnVal("kindofcontacts")); ?>">

        <input type="hidden" id="idtrf" name="idtrf" value="<?php echo $idtrf; ?>">

        <input type="hidden" id="formname" name="formname" value="editcontactsdetails">

        <input type="hidden" id="idcontacts" name="idcontacts" value="<?php echo $contactdata->getColumnVal("idcontacts"); ?>">

    </div>

    <button class="btn btn-gradient-primary" type="submit"><?php echo $edictcontacttitle; ?></button>



</form><br><br>

<button onclick="self.close()" type="button" class="btn btn-success waves-effect waves-light"><?php echo $closewindow; ?></button>





        </div><!--end card-body-->





    </div>

    <?php // contact search trial 

    ?>

    <div class="card">

        <div class="card-body">

            <div class="col-md-12 mb-4">

                <form class="needs-validation" id="searchname" name="searchname" action="#" method="GET" novalidate="">

                    <label for="validationServer02"><?php echo $anagraficacompany; ?></label>

                    <i class="fas fa-info-circle" data-toggle="modal" data-animation="bounce" data-target=".bs-example-modal-center"></i>

                    <input type="hidden" id="kindcontacts" name="kindcontacts" value="<?php echo ($contactdata->getColumnVal("kindofcontacts")); ?>">

                    <input type="hidden" id="idtrf" name="idtrf" value="<?php echo $idtrf; ?>">

                    <input type="hidden" id="formname" name="formname" value="searchnamedet">

                    <input type="hidden" id="idcontacts" name="idcontacts" value="<?php echo $contactdata->getColumnVal("idcontacts"); ?>">

                    <input type="text" class="form-control is-valid" id="companynamevalue" name="companynamevalue" placeholder="<?php echo $companyname; ?>" required="">

                    <input type="submit" value="Submit">

                    <br>

                    <b>Ex: </b><i><?php echo $searchsentence; ?></i>

                    <br />

                    <div id="display"></div>

            </div>

        </div><!--end card-body-->





    </div>





    <!-- end of page -->





    <!-- jQuery  -->

    <script src="assets/js/jquery.min.js"></script>

    <script src="assets/js/bootstrap.bundle.min.js"></script>

    <script src="assets/js/metismenu.min.js"></script>

    <script src="assets/js/waves.js"></script>

    <script src="assets/js/feather.min.js"></script>

    <script src="assets/js/jquery.slimscroll.min.js"></script>

    <script src="assets/js/jquery-ui.min.js"></script>



    <script src="../plugins/jquery-steps/jquery.steps.min.js"></script>

    <script src="assets/pages/jquery.form-wizard.init.js"></script>



    <!-- App js -->

    <script src="assets/js/app.js"></script>



</body>



</html>