Ésto es lo que he intentado pero no los carga.
Clase y función
class ProductData {
public static $tablename = "estudiantes";
public function ProductData(){
$this->nombres = "";
$this->apellidos = "";
$this->direccion = "";
$this->telefono = "";
$this->id_instrumento = "";
$this->fecha_inscripcion = "NOW()";
$this->nombre_pastor = "";
$this->tel_pastor = "";
$this->anio_escolar = "NOW()";
$this->image = "";
}
public function update(){
$sql = "update ".self::$tablename." set Nombres=\"$this->nombres\",Apellidos=\"$this->apellidos\",
Direccion=\"$this->direccion\",Telefono=\"$this->telefono\",id_Instrumento=\"$this->id_instrumento\",
id_Diplomado=\"$this->id_diplomado\",Nombre_pastor=\"$this->nombre_pastor\",Tel_pastor=\"$this->tel_pastor\" where id=$this->id";
Executor::doit($sql);
}
}
El POST
<?php
if(count($_POST)>0){
$product = ProductData::getById($_POST["product_id"]);
$product->nombres = $_POST["nombres"];
$product->apellidos = $_POST["apellidos"];
$product->direccion = $_POST["direccion"];
$product->telefono = $_POST["telefono"];
$product->id_instrumento = implode(",",$_POST["id_instrumento"]);
$product->id_diplomado = $_POST["id_diplomado"];
$product->nombre_pastor = $_POST["nombre_pastor"];
$product->tel_pastor = $_POST["tel_pastor"];
$product->user_id = $_SESSION["user_id"];
$product->update();
if(isset($_FILES["image"])){
$image = new Upload($_FILES["image"]);
if($image->uploaded){
$image->Process("storage/products/");
if($image->processed){
$product->image = $image->file_dst_name;
$product->update_image();
}
}
}
setcookie("prdupd","true");
print "<script>window.location='index.php?view=editestudiante&id=$_POST[product_id]';</script>";
El Formulario
<div class="form-group">
<label for="inputEmail1" class="col-lg-2 control-label">Instrumentos*</label>
<div class="col-md-3">
<?php
$instrumentos = InstrumentosData::getAllArray();
?>
<select multiple name="id_instrumento[]" class="form-control" required>
<option value="" >-- NINGUNO --</option>
<?php foreach($instrumentos as $instrumento):?>
<option value="<?php echo $instrumento->id;?>" <?php if($instrumento->id ==$product->id_Instrumento){ echo "selected";} ?>><?php echo $instrumento->Nombre;?></option>
<?php endforeach;?>
</select>
</div>