function ctrl_input_radio($errors, $name, $values, $labels, $className, $defaultValue)
{
    //check to see if any field values where posted
    $useDefault = true;
    $sent_value = sent_value($name);
    if (isset($sent_value) == true) {
        $useDefault = false;
    }
    for ($iV = 0; $iV < count($values); $iV++) {
        $checked;
        if (sent_value($name) == $values[$iV] || $useDefault == true && $defaultValue == $values[$iV]) {
            $checked = 'checked';
        } else {
            $checked = '';
        }
        echo "<input id=\"r-{values[{$iV}]}\" type=\"radio\" name=\"{$name}\" value=\"{$values[$iV]}\" {$checked}>";
        echo "<label for='r-{values[{$iV}]}'>{$labels[$iV]}</label>";
        echo '<br/>';
    }
}
<?php

include 'includes/functions/db.php';
include 'includes/functions/formControls.php';
include 'includes/accountSessions.php';
$errors = array();
//may later use login to enforce security one which staff members can edit
$loginId = $_SESSION['idLogin'];
$sHouseId = sent_value('sHouseId');
if (isset($_POST['submit'])) {
    //switch between update and deleteWHouse
    if (isset($_POST['toDelete'])) {
        db_delete_s_house($sHouseId);
        header("location: http://{$_SERVER['HTTP_HOST']}/property-Management-application/searchProperties.php");
        exit;
    } else {
        //update
        require 'includes/functions/validate.php';
        validateText($errors, $_POST, 'address');
        if (!$errors) {
            db_update_s_house($sHouseId, $_POST['address'], $_POST['description'], $_POST['suburb'], $_POST['state'], $_POST['postcode'], $_POST['numBath'], $_POST['numCarParks'], $_POST['maxOvernightGuests']);
            $myArray = array($sHouseId, $_POST['address'], $_POST['description'], $_POST['suburb'], $_POST['state'], $_POST['postcode'], $_POST['numBath'], $_POST['numCarParks'], $_POST['maxOvernightGuests']);
            header("location: http://{$_SERVER['HTTP_HOST']}/property-Management-application/searchProperties.php");
            exit;
        }
    }
}
?>
<html lang="en">
  <head>
    <meta charset="utf-8">
<?php

include 'includes/functions/db.php';
include 'includes/functions/formControls.php';
include 'includes/accountSessions.php';
$errors = array();
//may later use login to enforce security one which staff members can edit
$loginId = $_SESSION['idLogin'];
$propertyId = sent_value('propertyId');
if (isset($_POST['submit'])) {
    //switch between update and deleteWHouse
    if (isset($_POST['toDelete'])) {
        db_delete_w_house($propertyId);
        header("location: http://{$_SERVER['HTTP_HOST']}/property-Management-application/searchProperties.php");
        exit;
    } else {
        //update
        require 'includes/functions/validate.php';
        validateText($errors, $_POST, 'address');
        if (!$errors) {
            db_update_w_house($propertyId, $_POST['address'], $_POST['description'], $_POST['suburb'], $_POST['state'], $_POST['postcode'], $_POST['numBaths'], $_POST['numCarParks'], $_POST['numRooms'], $_POST['defaultRent'], $_POST['defaultPeriod'], $_POST['buyingPrice']);
            header("location: http://{$_SERVER['HTTP_HOST']}/property-Management-application/searchProperties.php");
            exit;
        }
    }
}
?>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">