Using FCK with PHP, i have strange error - can any one tell me what is wrong?
Below my code.
if (isset($_POST)) $postArray = &$_POST ; // 4.1.0 or later, use $_POST else $postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS foreach ( $postArray as $sForm => $value ) { if ( get_magic_quotes_gpc() ) $postedValue = htmlspecialchars( stripslashes( $value ) ) ; else $postedValue = htmlspecialchars( $value ) ; if (isset($_POST)) { // --------------------------------------- Script update (inserting news in to mysql) $KolejnyID = mysql_query('SELECT id,tekst,tytul FROM '.$Tabele.' ORDER BY id DESC '); $ID = mysql_fetch_array($KolejnyID); $PlusJedendoID = $ID['id']+1; $Zachowaj = mysql_query("INSERT INTO $Tabele(id,tekst,tytul) VALUES('$PlusJedendoID','$value','$_POST[tytul]') ") or die('Blad'); $KolejnyID = mysql_query('SELECT id,tekst,tytul FROM '.$Tabele.' ORDER BY id DESC '); $ID = mysql_fetch_array($KolejnyID); $Identyfikator = $ID['id']; $Wybierz = mysql_query('SELECT id,tekst,tytul FROM '.$Tabele.' WHERE id = '.$Identyfikator.' ORDER BY id DESC'); $ObecnaTresc = mysql_fetch_array($Wybierz); // --------------------------------------- Script update (inserting news in to mysql) } }
<form action="index.php?edycja=z_informacja&<?php echo $Tabele; ?>&nowy" method="post" enctype="multipart/form-data"> // --------------------------------------- I have added this text box - i need it <input type="text" name="tytul" value="<?php echo $ObecnaTresc['tytul']; ?>" size="45"><font face="Verdana" style="font-size: 8pt; font-weight:700" color="#800000"> - TYTUL ARTYKULU</font></font> <?php $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '../fckeditor/' ; $oFCKeditor->Value = $ObecnaTresc['tekst']; $oFCKeditor->Width = '100%' ; $oFCKeditor->Height = '210' ; $oFCKeditor->Create() ; ?> <input type="submit" value="Gotowe"> </form>
Problem is that it ads to mysql 2 or 3 times entry, wheen i remove text box it works ok.
[Post] problem I know but where and how to solve it.