PHP - Formulario (GET/POST)

 
Vista:

Formulario (GET/POST)

Publicado por Nando (1 intervención) el 01/09/2007 00:36:14
Hola,

quiero hacer un formulario para generar un codigo HTML en un text area... lo voy a utilizar para rellenar las variables de una pelicula Flash, con los valores que yo rellene en el formulario...

[[[[ Codigo Embed del Flash ]]]]

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="529" height="119" id="ficha" align="middle">
<param name="allowScriptAccess" value="sameDomain">
<param name="allowFullScreen" value="false">

<param name="movie" value="http://localhost/alumnos/fernando_hernandez/ficha_informativa/ficha.swf

?title=(TITULO DE LA PAGINA)
&thesite=(NOMBRE DE LA PAGINA)
&url_link=(URL DE LA PAGINA)
&category=(CATEGORIA DE LA PAGINA)

">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<param name="bgcolor" value="#ffffff">
<embed src="http://localhost/alumnos/fernando_hernandez/ficha_informativa/ficha.swf

?title=(TITULO DE LA PAGINA)
&thesite=(NOMBRE DE LA PAGINA)
&url_link=(URL DE LA PAGINA)
&category=(CATEGORIA DE LA PAGINA)

" quality="high" wmode="transparent" bgcolor="#ffffff" width="529" height="119" name="ficha" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashficha">
</object>

------------------------------------
Necesito rellenar las variables justo donde estan:

(TITULO DE LA PAGINA)
(NOMBRE DE LA PAGINA)
(URL DE LA PAGINA)
(CATEGORIA DE LA PAGINA)

y que luego aparezca todo el codigo Embed listo con los valores que rellene en el formulario, dentro de un <textarea>.

he hecho varios intentos con el post, pero parece que hago algo mal..... porfavorrrrrrrrr ayuda!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Formulario (GET/POST)

Publicado por Soraya (41 intervenciones) el 01/09/2007 02:58:23
Hola Nando, vamos a ver si entiendo lo que queres hacer. Según lo que entendí el formulario que queres hacer es sólo para pedir las variables y una vez enviado este formulario usas las variables para mostrar todos los datos en un textarea.
Si es esto la idea sería la siguiente:

<?php
if (!isset($_POST['Submit'])){ //ESTO ES SI TODAVIA NO SE ENVIO EL FORMULARIO LO MOSTRAS PARA QUE CARGUEN LAS VARIABLES
//EL FORMULARIO ES SENCILLO, TIENE LOS INPUTS QUE PIDEN LOS VALORES PARA LAS VARIABLES
?>
<form action="" name="formulario" method="post">
Título de la Página: <input type="text" name="titulo" />
Nombre de la Página: <input type="text" name="nombre" />
URL de la Página: <input type="text" name="url" />
Categoría de la Página: <input type="text" name="categoria" />
<input type="submit" name="Submit" value="Enviar" />
</form>
<?php
}
else { // EN EL ELSE RECUPERAS LAS VARIABLES
//recupero las variables enviadas por post y armo el textarea
$titulo = $_POST['titulo'];
$nombre = $_POST['nombre'];
$url = $_POST['url'];
$categoria = $_POST['categoria'];
//POR ULTIMO ARMAS EL TEXTAREA QUE CONTIENE EL CODIGO
?>
<form name="form_area_texto">
<textarea name="textarea" cols="60" rows="15" readonly="readonly">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="529" height="119" id="ficha" align="middle">
<param name="allowScriptAccess" value="sameDomain">
<param name="allowFullScreen" value="false">

<param name="movie" value="http://localhost/alumnos/fernando_hernandez/ficha_informativa/ficha.swf

?title=<?php echo $titulo; ?>
&thesite=<?php echo $nombre; ?>
&url_link=<?php echo $url; ?>
&category=<?php echo $categoria; ?>

">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<param name="bgcolor" value="#ffffff">
<embed src="http://localhost/alumnos/fernando_hernandez/ficha_informativa/ficha.swf

?title=<?php echo $titulo; ?>
&thesite=<?php echo $nombre; ?>
&url_link=<?php echo $url; ?>
&category=<?php echo $categoria; ?>

" quality="high" wmode="transparent" bgcolor="#ffffff" width="529" height="119" name="ficha" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashficha">
</object> </textarea>
</form>
<?php
} //del else
?>

En resúmen, para recuperar las variables enviadas en un formulario la forma es la siguiente:

Si el formulario tiene el método POST: $nombre_variable = $_POST['nombre'], donde 'nombre' es el mismo nombre que le pusiste en el INPUT.
Si el formulario tiene el método GET: $nombre_variable= $_GET['nombre'], donde nuevamente 'nombre' es el mismo que le pusiste en el INPUT.

Para introducir una variable php en un código html simplemente tenes que hacer un echo de la variable

<?php echo $nombre_variable; ?>

Bueno espero haberte sido de ayuda, avisame si te sirve y si no vemos que podemos hacer.
Saludos
Soraya
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar