Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/11/2002, 16:58
Avatar de Threepwood
Threepwood
 
Fecha de Ingreso: febrero-2002
Ubicación: Argentina
Mensajes: 906
Antigüedad: 22 años, 2 meses
Puntos: 4
Sera de variables?

Hola!

Con esto del paso de variables en php no muy le entiendo, tengo un formulario para agregar un comentario a una noticia:

FORM NAME="miFormu" ACTION="agregacomentario.php" METHOD="post">
<INPUT TYPE="hidden" NAME="id" VALUE="<? echo $id; ?>">
<strong> Nick :
<INPUT TYPE="text" NAME="nick" SIZE=20 MAXLENGTH=20>
<BR>
Comentario:
<textarea name="comentario" cols="28"></textarea>
<BR>
<INPUT TYPE="submit" CLASS="boton" VALUE="Enviar Comentario">
</strong>
</FORM>

El script de agregacomentario.php es el siguiente:

Código PHP:

include("conf.php");


$connection mysql_connect($host$user$pass) or die ("Adios");

mysql_select_db($db) or die ("Unable to select database!");

if(isset(
$_POST['id']) && isset($_POST['nick']) && isset($$_POST['comentario'])) 

if(
$_POST['comentario'] != ""

if(
$_POST['nick'] == ""

$nickNuevo "anonimo"

else 

$nickNuevo $_POST['nick']; 

$resultCom2 mysql_query("SELECT id FROM comentarios ORDER BY id DESC LIMIT 0,1"); 
$rowCom2 mysql_fetch_array($resultCom2); 
$con $rowCom2["id"]; 
mysql_free_result($resultCom2); 

$con++; 
$idNoticia $_POST['id']; 
$comentarioNoticia $_POST['comentario']; 

mysql_query("INSERT INTO comentarios VALUES 
('$con','$idNoticia','$nickNuevo','$comentarioNoticia')"
); 

echo 
"Comentario Enviado Con Exito.<BR>Espere Unos Segundos...<SCRIPT LANGUAGE="javascript">window.location.href = "".getenv('HTTP_REFERER')."";</SCRIPT>"

else 

echo 
"Debe Introducir Un Comentario."

 
mysql_close($connection);



El archivo conf.php es el que tiene las variables de acceso a la base de datos.

El erorr que manda el script es el siguiente:

Parse error: parse error, expecting `','' or `';'' in c:\scripts\ag2\noticias\agregacomentario.php on line 35

Y la linea 35 es:

Código PHP:
echo "Comentario Enviado Con Exito.<BR>Espere Unos Segundos...<SCRIPT LANGUAGE="javascript">window.location.href = "".getenv('HTTP_REFERER')."";</SCRIPT>"
Recupero mal las variables? o cual es el error?

Gracias..
__________________
Equívocos sin importancia