// Performing a select with all "*" and specifiying the CourtId to edit $results = $Court->SelectSpecific("*",array( "CourtId" => $id )); $results=$results[0]; //If an edit is performed if(! empty($_POST)) { $data=$_POST; if (!isset($data["CourtAvailSat"])) { $data["CourtAvailSat"]="off"; } if (!isset($data["CourtAvailSun"])) { $data["CourtAvailSun"]="off"; } $answer=$Court->Update($data,array( "CourtId" => $id )); header("Location: ./index.php"); } ?> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <h4>Modifier un terrain</h4> <form method="post"> <select name="CourtGroundType" required> option value="<? echo $results["CourtGroundType"]; ?>"><? echo $results["CourtGroundType"];?></option> <? foreach ($CourtGroundType as $Type):?> <? if ($Type==$results["CourtGroundType"]) continue; ?> <option value="<? echo $Type; ?>"><? echo $Type;?></option>