Perdita di dati al passaggio della funzione bbcode
Non riesco a capire come mai, i dati che invio tramite form, finché li stampo con questa sintassi
$_POST[nome input]
funzionano correttamente, ma appena li faccio passare all'interno della funzione bbcode quindi
$testo=bbcode($_POST[nome input]);
se provo a stampare la variabile $testo, questa non mi da risultato, cioè non mi scrive nulla...
Il codice a cui mi riferisco è questo
Codice PHP:
if ($_POST[cmd] == FALSE)
{
echo "<form action=\"$REQUEST_URI\" method=\"post\" name=\"new\">\n";
echo "<font face=\"arial\" size=\"2\">Messaggio autenticato come <strong>$username</strong></font><br><br>\n";
echo "<input type=\"hidden\" name=\"autore\" value=\"$username\">\n";
echo "<font face=\"arial\" size=\"2\">Titolo:</font><br>\n";
echo "<input type=\"text\" name=\"titolo\"><br /><br>\n\n";
echo "<font face=\"arial\" size=\"2\">Messaggio:</font><br>\n";
include("bbcode2.php");
textarea("Nuovo", "Qui contenuto di default", "new");
echo "<input type=\"hidden\" name=\"cmd\" value=\"add\">\n";
echo "<input type=\"submit\" value=\"Pubblica il messaggio\">\n";
echo "</form>\n";
}
else
{
if ($_POST[titolo] == FALSE OR $_POST[autore] == FALSE OR $_POST[Nuovo] == FALSE)
{
echo "<p>Tutti i campi sono obbligatori.";
}
else
{
include("bbcode.php");
$contenuto_textarea=bbcode($_POST['Nuovo']);
echo "<p>Il tuo topic è stato pubblicato.";
$_POST[testo] = str_replace("\n", "<br>", $contenuto_textarea);
$query = "INSERT INTO forum_lite_topics ( id , forum_id , data , autore , titolo ) VALUES ('' , '" . $_GET[f] . "' , '" . date("d/m/Y G:i") . "' , '" . $_POST[autore] . "' , '" . $_POST[titolo] . "')";
mysql_query("$query");
echo mysql_error();
$query2 = "INSERT INTO forum_lite_thread ( id , topic_id , data , autore , titolo , testo ) VALUES ('' , '" . $_GET[t] . "' , '" . date("d/m/Y G:i") . "' , '" . $_POST[autore] . "' , '" . $_POST[titolo] . "' , '" . $_POST[testo] . "')";
mysql_query("$query2");
echo mysql_error();
}
}