<?php        
	$hoy = date("Y-m-d H:i:s");
	$id = $_POST["id"];
	$urlRedirect = $_POST["url"];

	include("../models/connect.php");
	include("../models/arrays.php");
	$query = mysqli_query($connect,"SELECT * FROM Noticias WHERE id = '".$id."' ");
	$data = mysqli_fetch_array($query)
?>

<form action="" method="post" enctype="multipart/form-data">
                	<input type="hidden" name="id_noticia" value="<?php echo $data["id"]; ?>" />
					<div class="row">
                        
                        <div class="col-md-6">
                          	<label class="ti_label">Título</label>
                            <input type="text" class="form-control" name="titulo" value="<?php echo $data["titulo"]; ?>" required>
                        </div>

                        <div class="col-md-6">
                          	<label class="ti_label">Estado</label>
                            <select class="form-control" name="estado">
                            	<?php
									foreach($Array_Estado as $estado){
										
										if( $estado[0] ==  $data["estado"] ){
											echo '<option value="'.$estado[0].'" selected="selected">'.$estado[1].'</option>';
										}
										else{
											echo '<option value="'.$estado[0].'">'.$estado[1].'</option>';
										}
											
										
									}
                                ?>
                            </select>
                        </div>
                        
                        <div class="col-md-12">
                          	<label class="ti_label">Contenido</label>
                            <textarea class="form-control" name="contenido" required><?php echo $data["contenido"]; ?></textarea>
                        </div>
                        
                        
                        
                        <div class="col-md-6">
                          	<label class="ti_label">Imagen</label>
                            <div id="image">
                            	<?php
									if($data["image"] != ""){
										echo '<img src="img/delete.png" width="30" onclick="Del_Imagen(this,1)" style="float: right; margin-bottom: -30px; position: relative;"/><img src="http://ganadeuna.com/recursos/'.$data["image"].'" style="width:100%">';
									}
									else{
										echo '<input type="file" class="form-control" name="image" required>';
									}
								?>
                            </div>
                        </div>

                        
                        <div class="col-md-12" style="margin-top:15px; text-align: right;">
                            <button type="submit" class="btn btn-success">Guardar</button>
                            <button type="button" class="btn btn-danger" data-dismiss="modal" aria-label="Close">Cerrar</button>
                        </div>
                        
					</div>
</form>