Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2008, 04:25
Avatar de frins
frins
 
Fecha de Ingreso: enero-2008
Ubicación: Osor, Girona
Mensajes: 227
Antigüedad: 16 años, 3 meses
Puntos: 5
Enviar codigo por formulario post

Hola amigos, mirad, tengo este código php en la pagina video.php:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upload a video</title>
</head>
<body>
<?php
/////////////////////////////////////
//////// Security Check ////////////
///////////////////////////////////
$usuari $_GET[usuari];
$id $_GET[id];
$connectmysql_connect('localhost''root''972190131')
    or die(
'Could not connect. Please contact to our webmaster (webmaster@localhost). The error is: ' mysql_error());
mysql_select_db('rateit') or die('Could not select database. Please contact to our webmaster (webmaster@localhost).');
$query mysql_query("SELECT username, user_id FROM users WHERE username='".$usuari."' AND user_id='".$id."' LIMIT 1");
if(
mysql_num_rows($query) > 0) {
} else {
  die(
'This user ' $usuari ' and this id ' $id " doesn't appear in our database. <p> If you are sure that you register in our site please contact our webmaster (webmaster@localhost).</p>");

mysql_close($connect);
?>
<?php
echo '<form id="video" name="video" method="post" action="video-final.php?usuari=' $usuari '&id=' $id '">
  <p>Youtube html code:<br />
    <textarea name="code" cols="100" rows="10" id="code"></textarea>
  <p><br />
    Video Title
    <input name="Title" type="text" id="Title" size="91" />
  <p>Video Description:
  <p>
    <textarea name="Description" cols="100" rows="5" id="Description"></textarea>
  <p>Category
  Video Category
    <select name="Category" size="1" id="Category">
      <option selected="selected">Select a category</option>
      <option value="dell">Dell Desktops &amp; Laptops</option>
      <option value="acer">Acer Desktops &amp; Laptops</option>
      <option value="lg">Lg Desktops &amp; Laptops</option>
      <option value="nokia">Nokia Movile Phones</option>
      <option value="cameras">Digital Cameras</option>
      <option value="music">Music Videos</option>
      <option value="tutorials">Videotutorials</option>
      <option value="pets">Pets</option>
      <option value="places">Places</option>
      <option value="spots">Spots</option>
    </select>
  <p>
    <input type="submit" name="send" id="send" value="Send" />
  
</form>'
;
?>
<?php
$html 
$_GET['code'];
echo 
$html;
?>
</body>
</html>
Y en la pagina video-final.php este:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upload video</title>
</head>
<body>
<?php
/////////////////////////////////////
//////// Security Check ////////////
///////////////////////////////////
$usuari $_GET[usuari];
$id $_GET[id];
?>

<?php
$code 
$_POST[code];
$title $_POSTTitle];
$description $_POST[Description];
echo 
$code;

?>
</body>
</html>
En el primero hay un formulario para mostrar videos del youtube, y le pegas el codigo que muestra en la pagina del video.
Y lo paso por POST a la pagina video-final.php y el codigo enviado(html) me queda así:
Código HTML:
<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/fm0T7_SGee4&hl=es&color1=0x402061&color2=0x9461ca\"></param><embed src=\"http://www.youtube.com/v/fm0T7_SGee4&hl=es&color1=0x402061&color2=0x9461ca\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"></embed></object> 
Pero tendira que ser:
Código HTML:
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/fm0T7_SGee4&hl=es&color1=0x402061&color2=0x9461ca"></param><embed src="http://www.youtube.com/v/fm0T7_SGee4&hl=es&color1=0x402061&color2=0x9461ca" type="application/x-shockwave-flash" width="425" height="344"></embed></object> 
¿Cómo puedo hacer para que salga el código bien?