Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

fpimenta

undefined index, undefined variable

Recommended Posts

fiz um script que recebe variaveis de um formulario

codigo

titulo

categoria

dia

mes

ano

arquivo

sinopse

 

mas esta dando erros

 

Notice: Undefined index: arquivo in c:\inetpub\wwwroot\locadora\adm\news\cad_news.php on line 25

 

Notice: Undefined index: arquivo in c:\inetpub\wwwroot\locadora\adm\news\cad_news.php on line 25

 

a mais para baixo

 

Notice: Undefined variable: imagem in c:\inetpub\wwwroot\locadora\adm\news\cad_news.php on line 67

 

o que pode ser, ja remontei o codigo 2 vezes, ja reinstalei o php

detalhe: register_globals esta ativado

 

abaixo segue o codigo

 

 

 

 

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<?php

$conexao = mysql_connect('localhost','fabner','pimenta');

if($conexao==NULL)

{

echo "A conexão não pode ser feita!!";

}

else

{

$banco = mysql_select_db('locadora');

if($banco=NULL)

{

echo "O banco não poe ser selecionado";

}

else

{

$dir = 'c:\php\uploadtemp\\';

print "<pre>";

if(move_uploaded_file($_FILES['arquivo']['tmp_name'], $dir . $_FILES['arquivo']['name'])) {

echo "<html>";

echo "<head>";

echo "<title>Untitled Document</title>";

echo "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";

//echo "<meta http-equiv='refresh' content='5;URL=insert.htm'>";

echo "</head>";

echo "<body bgcolor='#000000' text='#FF0000'>";

echo "<br>";

echo "<br>";

echo "<table width='52%' border='1' align='center' bordercolor='#FF0000' bgcolor='#660000'>";

echo "<tr>";

echo "<td><div align='center'><strong><font size='7'>O cadastramento da imagem foi feito com sucesso! </font></strong> </div></td>";

echo "</tr>";

echo "</table>";

echo "<strong><font size='6'> </font></strong>";

echo "</body>";

echo "</html>";

$imagem = $_FILES['arquivo']['name'];

}

else

{

echo "<html>";

echo "<head>";

echo "<title>Untitled Document</title>";

echo "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";

//echo "<meta http-equiv='refresh' content='5;URL=insert.htm'>";

echo "</head>";

echo "<body bgcolor='#000000' text='#FF0000'>";

echo "<br>";

echo "<br>";

echo "<table width='52%' border='1' align='center' bordercolor='#FF0000' bgcolor='#660000'>";

echo "<tr>";

echo "<td><div align='center'><strong><font size='7'>O cadastramento da imagem não foi feito! </font></strong> </div></td>";

echo "</tr>";

echo "</table>";

echo "<strong><font size='6'> </font></strong>";

echo "</body>";

echo "</html>";

}

 

$grava = mysql_query("insert into novidade(codigo,titulo,categoria,dia,mes,ano,sinopse,imagem) values ('$codigo','$titulo','$categoria','$dia','$mes','$ano','$sinopse','$imagem')", $conexao);

if($grava==NULL)

{

echo "<html>";

echo "<head>";

echo "<title>Untitled Document</title>";

echo "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";

echo "<meta http-equiv='refresh' content='5;URL=insert.htm'>";

echo "</head>";

echo "<body bgcolor='#000000' text='#FF0000'>";

echo "<br>";

echo "<br>";

echo "<table width='52%' border='1' align='center' bordercolor='#FF0000' bgcolor='#660000'>";

echo "<tr>";

echo "<td><div align='center'><strong><font size='7'>O cadastramento dos dados não pode ser feito! </font></strong> </div></td>";

echo "</tr>";

echo "</table>";

echo "<strong><font size='6'> </font></strong>";

echo "</body>";

echo "</html>";

}

else

{

echo "<html>";

echo "<head>";

echo "<title>Untitled Document</title>";

echo "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";

echo "<meta http-equiv='refresh' content='5;URL=insert.htm'>";

echo "</head>";

echo "<body bgcolor='#000000' text='#FF0000'>";

echo "<br>";

echo "<br>";

echo "<table width='52%' border='1' align='center' bordercolor='#FF0000' bgcolor='#660000'>";

echo "<tr>";

echo "<td><div align='center'><strong><font size='7'>O cadastramento dos dados foi feito com sucesso! </font></strong> </div></td>";

echo "</tr>";

echo "</table>";

echo "<strong><font size='6'> </font></strong>";

echo "</body>";

echo "</html>";

}

 

}

 

 

}

 

mysql_close($conexao);

 

 

?>

 

</body>

</html>

 

 

obrigado a todos

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara deixa as linhas em que estao os erros em negrito pra gente poder identificar melhor pra voce pq aqui nao mostra as linhas entao fica dificl :D

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.