Ejemplo n.º 1
0
<?php 
include 'DAO/coachDao.php';
$coachId = $_GET["coachId"];
$coaches = GetCoach($coachId);
foreach ($coaches as $c) {
    $coachName = $c->name;
    $userType = $c->userType;
}
if ("Edit" == $_POST["submit"]) {
    $coachId = $_POST["coachId"];
    $coachName = $_POST["name"];
    $userType = $_POST["userType"];
    $squadId = $_POST["squadId"];
    $coachId = $_POST["coachId"];
    $sport = $_POST["sport"];
    EditCoach($coachId, $coachName, $userType);
    echo "You have successfully edited " . $coachName . "!";
    echo '<br>';
    echo "<a href='/coach/searchCoach.php'>back to search</a>";
} else {
    if ($coachId == null) {
        echo "No Coach was selected, you're not supposed to be here!";
    } else {
        echo '<div class="editCoachForm">';
        echo '<form action="editCoach.php" method="post">';
        echo '<input type="hidden" name="coachId" value="' . $coachId . '"/>';
        echo 'Coach Name: <input type="text" name="name" value="' . $coachName . '"/>';
        echo '<br>';
        echo 'User Type: <input type="text" name="userType" value="' . $userType . '"/>';
        echo '<br>';
        echo '<div class="btnEdit">';
Ejemplo n.º 2
0
        if (!$session->isCoach()) {
            header("Location: http://localhost/Coach/User/main.php");
            //			header("Location: http://localhost/Coach/searchCoach.php");
        }
    } else {
        if ($_POST["saveCoach"] != null) {
            $coachId = $_POST["id"];
            $coachName = $_POST["name"];
            $coachSSSNo = $_POST["SSSNo"];
            $id = AddCoach($coachName, $coachSSSNo);
            $coachAddress = $_POST["address"];
            $coachTelNo = $_POST["telNo"];
            $coachMobileNo = $_POST["mobileNo"];
            $coachEmail = $_POST["email"];
            if (isset($coachId)) {
                EditCoach($coachId, $coachName, $coachSSSNo, $coachAddress, $coachTelNo, $coachMobileNo, $coachEmail);
            } else {
                AddCoachDetails($id, $coachAddress, $coachTelNo, $coachMobileNo, $coachEmail);
            }
            echo 'You have successfully added coach ' . $coachName . '!';
            echo '<br />';
            echo 'You have set the coach\'s SSS No as ' . $coachSSSNo . '.';
        } else {
            ?>
		<?php 
            $coachId = $_GET["coachId"];
            if (isset($coachId)) {
                $coach = GetCoach($coachId);
                foreach ($coach as $c) {
                    $coachName = $c->name;
                    $coachSSSNo = $c->SSSNo;