Perdón, pero no entiendo ya lo intente como me dices de guardar el echo en variables pero no se si de esta manera,
Esta es
peticiones.php Código PHP:
<?php
if(isset($_POST['submit'])) {}?>
<?php
#Declaramos las variables que vamos a usar
$servidor= "localhost";
$usuario ="miusuario";
$contrasena ="micontrasena";
$basededatos ="mibase";
$cancion = $_POST['cancion'];
$artista = $_POST['artista'];
#Hacemos la conexión
$conexion=mysql_connect("$servidor","$usuario","$contrasena")
or die ("POR FAVOR, REINTENTA EN 20 SEGUNDOS.");
mysql_select_db($basededatos,$conexion);
if ($cancion=="")
{
$falta="echo 'Escribe el nombre de la canción;'";
exit();
}
else
{
$sql= "INSERT INTO peticiones (cancion,artista) VALUES ('$cancion', '$artista')";
$resultado= mysql_query($sql);
$recibida = "echo 'Hemos recibido tu petición';";
?>
Esto viene en la misma pagina cuando cierro el php: Código HTML:
<html><head>
<title>peticiones</title>
</head><body>
<table style="text-align: left; margin-left: auto; margin-right: auto; width: 178px; height: 309px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr align="center"><td>Ùltimas Peticiones</td></tr><tr>
<td style="height: 28px; text-align: center;">Aqui iria el echo<br>
</td>
</tr>
<tr>
<td style="height: 190px;">
<table style="width: 190px; height: 177px; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td>$1</td>
</tr>
<tr>
<td>$2</td>
</tr>
<tr>
<td>$3</td>
</tr>
<tr>
<td>$4</td>
</tr>
<tr>
<td>$5</td>
</tr>
<tr>
<td>$6</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="text-align: center; vertical-align: top; height: 112px;">
<form action="peticion.php" method="post">
<table style="text-align: left; width: 194px; height: 85px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 76px;">Canción:</td>
<td style="width: 98px;"><input maxlength="30" name="cancion"></td>
</tr>
<tr>
<td style="width: 76px;">Artista:</td>
<td style="width: 98px;"><input maxlength="30" name="artista"></td>
</tr>
<tr>
<td style="width: 76px;"></td>
<td style="width: 98px; text-align: center;"><input value="Pedir" type="submit"></td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
<br>
</body></html>
Pues es así como le hice y no me sale ningún error, pero el output es una página en blanco.
Por favor alguien ayúdeme ! :