zmagam się od dłuższego czasu z następującą kwestią:
<?php require_once(\"funkcje/BD.class.php\"); include \"ksiega/common_db.inc\"; function dodajDoBazy($news_id, $news_tytul, $news_autor, $news_tresc, $data) { { } else { $news_tytul = \"NULL\"; $error = 1; } { }else{ $news_autor = \"NULL\"; $error = 1; } { }else{ $news_tresc = \"NULL\"; $error = 1; } { }else{ $data = \"NULL\"; $error = 1; } if($error !=1) { $link_id = db_connect($default_dbname); $query = \"INSERT INTO news (news_id, news_tytul, news_autor, news_tresc, data) VALUES ('\".$news_id.\"','\".$news_tytul.\"','\".$news_autor.\"','\".$news_tresc.\"', '\".$data.\"')\"; if(!$result) { exit; } } } $news_id = $_POST[\"news_id\"]; $news_tytul = $_POST[\"news_tytul\"]; $news_autor = $_POST[\"news_autor\"]; $news_tresc = $_POST[\"news_tresc\"]; $data = $_POST[\"data\"]; { echo '<p><a href=\"http://www.divideo.com.pl/index.php?op=38\">Powrót do strony administracyjnej</a></p>'; require_once(\"dodatkowe/formularz-nowy-news.htm\"); if($news_id == \"NULL\" && $news_tytul == \"\" && news_autor == \"\" && $news_tresc == \"\" && $data == \"\") { } else{ dodajDoBazy($news_id, $news_tytul, $news_autor, $news_tresc, $data); } } else { } ?>
chodzi mi najbardziej o pogrubiony fragment kodu.
if($news_id == "NULL" && $news_tytul == "" && news_autor == "" && $news_tresc == "" && $data == "")
{
}
else{
dodajDoBazy($news_id, $news_tytul, $news_autor, $news_tresc, $data);
}
}
Kiedy wejdę na daną stronę to chcę widzieć formularz w który mogę wklepać nowego newsa. I tak jest, z tym że od razu wyświetla mi komunikaty zawarte w funkcji:
Zapomniales podac tytul newsa!
Zapomniales podac autora newsa!
Zapomniales podac tresc newsa!
Zapomniales podac date dodania newsa!
Nie bardzo wiem, jak zrobić aby funkcja była reazliowana dopiero jak kliknę na formularzu wyślij, a nie od razu jak wejdę na tą stronę.