galera...to tentando fazer isso seguindo o tutorial do marcelo oliveira
alguém sabe onde esta o erro?
Notice: Undefined variable: foto_name in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 34
Notice: Undefined variable: foto in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 41
Notice: Undefined variable: foto_name in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 41
Warning: Cannot modify header information - headers already sent by (output started at c:\arquivos de programas\easyphp1-8\www\insert_noticia.php:34) in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 51
Pergunta
ronaldosdb
galera...to tentando fazer isso seguindo o tutorial do marcelo oliveira
alguém sabe onde esta o erro?
Notice: Undefined variable: foto_name in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 34
Notice: Undefined variable: foto in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 41
Notice: Undefined variable: foto_name in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 41
Warning: Cannot modify header information - headers already sent by (output started at c:\arquivos de programas\easyphp1-8\www\insert_noticia.php:34) in c:\arquivos de programas\easyphp1-8\www\insert_noticia.php on line 51
arquivo inserir.php
<?php require_once('Connections/ronaldo.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO noticias (id_noticia, titulo, corpo, foto, autor) VALUES (%s, %s, %s,'$foto_name', %s)", GetSQLValueString($_POST['id_noticia'], "int"), GetSQLValueString($_POST['titulo'], "text"), GetSQLValueString($_POST['corpo'], "text"), GetSQLValueString($_POST['foto'], "text"), GetSQLValueString($_POST['autor'], "text")); copy ($foto,"images/".$foto_name); mysql_select_db($database_ronaldo, $ronaldo); $Result1 = mysql_query($insertSQL, $ronaldo) or die(mysql_error()); $insertGoTo = "/inserted_noticia.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Inserção de Notícias</title> <link href="/css/noticia.css" rel="stylesheet" type="text/css"> </head> <body> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center" class="tabela"> <tr valign="baseline" class="noticia"> <td nowrap align="right">Titulo:</td> <td><input type="text" name="titulo" value="" size="32"></td> </tr> <tr valign="baseline" class="noticia"> <td nowrap align="right">Corpo:</td> <td><textarea name="corpo" cols="80" rows="30"></textarea></td> </tr> <tr valign="baseline" class="noticia"> <td nowrap align="right">Foto:</td> <td><input name="foto" type="file" lang="pt" size="32"></td> </tr> <tr valign="baseline" class="noticia"> <td nowrap align="right">Autor:</td> <td><input type="text" name="autor" value="" size="32"></td> </tr> <tr valign="baseline" class="noticia"> <td nowrap align="right"> </td> <td><input type="submit" value="Cadastrar"></td> </tr> </table> <input type="hidden" name="id_noticia" value=""> <input type="hidden" name="MM_insert" value="form1"> </form> <p> </p> </body> </html>Link para o comentário
Compartilhar em outros sites
17 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.