Boa Tarde amigos, tenho um sisteminha de notícias no meu site. Gostaria que nas notícia eu conseguisse colocar links exemplo: <a href="http://esportecoxim....ia=1119">Clique Aqui</a> Mais ele não aceita. Alguém pode me ajudar qual a função para tornar o texto em html????
Problemas Com Text Que Não Aceita Html
Started By Allan Jones, 03/12/2010, 18:36
4 replies to this topic
#1
Posted 03/12/2010, 18:36
#2
Posted 06/12/2010, 14:52
Olá,
Você pode colocar o código aqui para podermos verificar
Abraço
Você pode colocar o código aqui para podermos verificar
Abraço
#3
Posted 07/02/2011, 11:49
Olá,
Você pode colocar o código aqui para podermos verificar
Abraço
Este é o cadastrar.php!!!
<form method="post" action="inserir.php" enctype="multipart/form-data">
<table width="494" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td align="center" valign="middle" colspan="2" style="padding-bottom: 1em">
<font style="font-family:'times new roman'; font-weight: bold; font-size: 16px">CADASTRO DE NOTÍCIAS</font></td>
</tr>
<tr>
<td align="right" width="210" class="preto">Categoria:</td>
<? include ("lista_cat.php"); ?>
</tr>
<tr>
<td align="right" width="210" class="preto">Título:</td>
<td width="450" align="left">
<input type="text" class="form" name="titulo" value="" size="34" maxlength="100">
</td>
</tr>
<tr>
<td align="right" width="210" class="preto">Subtítulo:</td>
<td width="450" align="left">
<input type="text" class="form" name="subtitulo" value="" size="34" maxlength="120">
</td>
</tr>
</tr>
<tr>
<td align="right" width="210" class="preto">Texto completo:</td>
<td width="450" align="left">
<textarea name="texto" class="msg" value="" rows="10" cols="31"></textarea></td>
</tr>
<tr>
<td align="right" width="210" class="preto">Imagem:</td>
<td width="450" align="left">
<input class="form" type="File" name="foto" size="17">
</tr>
<tr>
<td align="right" width="210" class="preto">Fonte:</td>
<td width="450" align="left">
<input type="text" class="form" name="fonte" size="17" value="Redação">
</tr>
<tr>
<td align="right" width="210" class="preto">Fotógrafo:</td>
<td width="450" align="left">
<input type="text" class="form" name="fonte_foto" size="17" value="">
</tr>
<tr>
<td align="right" width="210" class="preto">Data:</td>
<td width="450" align="left">
<input type="text" class="form" name="data" size="17" value="<? echo $data2; ?>">
</tr>
<tr>
<td align="right" width="210" class="preto">Hora:</td>
<td width="450" align="left">
<input type="text" class="form" name="hora" size="17" value="<? echo $hora; ?>">
</tr>
<tr>
<td align="right" width="210" class="preto">Notícia Destaque?</td>
<td width="450" align="left" class="preto">
SIM<input type="radio" class="form" name="dstq" value="sim">
NÃO<input type="radio" class="form" name="dstq" value="não">
CAPA<input type="radio" class="form" name="dstq" value="capa">
</td>
</tr>
<tr>
<td align="center" colspan="2" style="padding-top: 2em">
<input class="submit" type="Submit" name="salvar" value="Cadastrar">
<input class="submit" type="Reset" name="limpar" value="Limpar">
</td>
</tr>
</table>
</form>
<? include ("../include/base.php"); ?>Ok Este é o inserir.php!!!
<?
if ($foto != "") {
if ($foto_size > $tamanho)
{die("<font color=\"red\">Arquivo da foto muito grande.</font>
Ele deve ter $tamanho bytes ou menos.<p>Clique<a href=\"javascript:history.back()\">
<b>aqui</b></a> para Voltar");}}
if (trim($HTTP_POST_FILES["foto"]["tmp_name"]) != "") {
$foto = 'fotos/' . md5(md5($HTTP_POST_VARS["name"]) . date("YmdHis")) . strstr(basename($HTTP_POST_FILES["foto"]["name"]), '.');
// arquivo com o local de origem
$orig = $HTTP_POST_FILES["foto"]["tmp_name"];
// copia o arquivo para o destino
if (!copy($orig, "../$foto")) {
echo "<br><br><center>Problemas no upload do arquivo: " . $HTTP_POST_FILES["foto"]["name"] . "...<br>";
$erro = "yes";
$foto = "";
}
}
/* montando sql de inserção de dados */
$sqli = " INSERT INTO noticias (categoria, titulo, subtitulo, texto, fonte, fonte_foto, data, hora, dstq, foto) VALUES
('" . addslashes($HTTP_POST_VARS["categoria"]) . "', '" . addslashes($HTTP_POST_VARS["titulo"]) . "', '" . addslashes($HTTP_POST_VARS["subtitulo"]) . "', '" . addslashes($HTTP_POST_VARS["texto"]) . "', '" . addslashes($HTTP_POST_VARS["fonte"]) . "', '" . addslashes($HTTP_POST_VARS["fonte_foto"]) . "', '" . addslashes($HTTP_POST_VARS["data"]) . "', '" . addslashes($HTTP_POST_VARS["hora"]) . "', '" . addslashes($HTTP_POST_VARS["dstq"]) . "', '$foto')";
/* executa sql */
if (!@mysql_query($sqli)) {
echo "<br><br><center><font class='adm'>Problemas ao efetuar cadastro: " . mysql_error() . ".</font></center>";
exit();
} else {
echo "<br><br><center><font class='adm'>Cadastro efetuado com sucesso!</center>
<script>window.location='cadastrar.php';</script>";
if ($erro == "yes") {
echo "<br><center>A imagem não foi enviada ao servidor.</font></center>";
}
exit();
}
?>
Vejam o exemplo em http://www.esporteco...hp?noticia=1375 , não aceita nenhum código html, negrito, itálico, img src...nada.
Seria algum problema com o enctype????
ou com o (nl2br(htmlentities($texto)) na pagina de exibir???
Edição feita por: Allan Jones, 07/02/2011, 11:37.
#4
Posted 09/02/2011, 15:22
Olá.
Experimente usar apenas:
Outro ponto. A manipulação de dados enviados em um formulário através de comandos como esse está em desuso:
Procure utilizar:
Mais informações em http://www.php.net/m...ial.oldcode.php
Até mais.
Experimente usar apenas:
nl2br($texto)
Outro ponto. A manipulação de dados enviados em um formulário através de comandos como esse está em desuso:
$HTTP_POST_VARS["variavelQualquer"]
Procure utilizar:
$_POST["variavelQualquer"], $_GET["variavelQualquer"], $_REQUEST["variavelQualquer"].
Mais informações em http://www.php.net/m...ial.oldcode.php
Até mais.
#5
Posted 09/02/2011, 19:56
Olá.
Experimente usar apenas:nl2br($texto)
Outro ponto. A manipulação de dados enviados em um formulário através de comandos como esse está em desuso:$HTTP_POST_VARS["variavelQualquer"]
Procure utilizar:$_POST["variavelQualquer"], $_GET["variavelQualquer"], $_REQUEST["variavelQualquer"].
Mais informações em http://www.php.net/manual/pt_BR/tutorial.oldcode.php'>http://www.php.net/manual/pt_BR/tutorial.oldcode.php']http://www.php.net/manual/pt_BR/tutorial.oldcode.php
Até mais.
Obrigadão cara, resolveu mesmo, eu estava com medo de tirar o htmlentities e estragar a acentuação, mas deu certo. Obrigado mesmo, não sabe o quanto resolveu aqui pra mim!!!
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)










