Foros del Web » Programando para Internet » PHP »

Guardar datos en array para crear div

Estas en el tema de Guardar datos en array para crear div en el foro de PHP en Foros del Web. Hola, necesitaria guardar datos en un array para utilizarlos en la creacion de div. Si cargo 10 datos, crear 10 divs. Espero sus respuestas. Dejo ...
  #1 (permalink)  
Antiguo 25/05/2011, 15:21
 
Fecha de Ingreso: mayo-2011
Mensajes: 23
Antigüedad: 12 años, 11 meses
Puntos: 0
Guardar datos en array para crear div

Hola, necesitaria guardar datos en un array para utilizarlos en la creacion de div. Si cargo 10 datos, crear 10 divs. Espero sus respuestas. Dejo el codigo que genera solo un div y al cargar nuevos datos borra el anterio. Gracias saludos

<form name="form1" method="POST">
Top
<input type="text" name="top" value="<?php if(isset($_POST['top'])) echo $_POST['top']; ?>" />
<br />
Left
<input type="text" name="left" value="<?php if(isset($_POST['left'])) echo $_POST['left']; ?>" />
<br />
Width
<input type="text" name="width" value="<?php if(isset($_POST['width'])) echo $_POST['width']; ?>" />
<br />
Height
<input type="text" name="height" value="<?php if(isset($_POST['height'])) echo $_POST['height']; ?>" />
<br />
<input type="submit"/>
</form>
<br /><br />
<?php
if(isset($_POST["top"]) && isset($_POST["left"]) && isset($_POST["width"]) && isset($_POST["height"]))
{
$top=($_POST["top"]);
$left=($_POST["left"]);
$width=($_POST["width"]);
$height=($_POST["height"]);
if(!is_numeric($top)) die ('Top no es numerico <br />');
if(!is_numeric($left)) die ('Left no es numerico <br />');
if(!is_numeric($width)) die ('Width no es numerico <br />');
if(!is_numeric($height)) die ('Height no es numerico <br />');
echo "<div style = 'top:".$top."px; left:".$left."px; height:".$height."px; width:".$width."px; background-color:blue; position:relative;'>";
echo "</div>";
}

?>

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:18.