Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/05/2011, 16:36
matiasgreisert
 
Fecha de Ingreso: mayo-2011
Mensajes: 23
Antigüedad: 13 años
Puntos: 0
Creacion de div con valores de post

Hola, estoy intentando crear un div luego de pedir datos por metodo post en un formulario pero no me funciona. Sé que no esta optimizado el codigo pero no soy un experto. Espero algun consejo o metodo para que funcione. Desde ya muchas gracias Saludos.

<?php if($_SERVER['REQUEST_METHOD']=="GET"){ ?>
<form method="POST">
Top
<input type="text" name="top" />
<br />
Left
<input type="text" name="left" />
<br />
Width
<input type="text" name="width" />
<br />
Height
<input type="text" name="height" />
<br />
<input type="submit"/>
</form>
<?php
}else if($_SERVER['REQUEST_METHOD']=="POST"){
if(isset($_POST["top"])){
if(is_numeric($_POST["top"]))
$top= $_POST["top"];
else {
echo 'Top no es numerico';
}
}
if(isset($_POST["left"])){
if(is_numeric($_POST["left"]))
$left= $_POST["left"];
else {
echo 'Left no es numerico';
}
}
if(isset($_POST["width"])){
if(is_numeric($_POST["width"]))
$width= $_POST["width"];
else {
echo 'Width no es numerico';
}
}
if(isset($_POST["height"])){
if(is_numeric($_POST["height"]))
$height= $_POST["height"];
else {
echo 'Width no es numerico';
}
}
if(is_numeric($width)&&($height)&&($left)&&($top)) {
echo "<div top=$top.'px' left=$left.'px' height=$height.'px' width=$width.'px' backgroud-color=blue>";
echo "</div>";
}
}
?>