uisneach Posted March 6, 2010 Share Posted March 6, 2010 Hello EB I need to generate pages with php code. I have a form to enter title, text and with db my sql I recover the details on a page on my website <form enctype="multipart/form-data" action="articoli.php" method="POST"><br /> <h1 class="grigio">Sezione 1: nuovo articolo</h1><br /> Titolo          <input type="text" name="titolo" value="" size="32"><br /> SottoTitolo    <input type="text" name="sottotitolo" value="" size="32"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="5000000"> Aggiungi un'immagine: <input name="userfile" type="file"> <textarea name="testo" rows="15" cols="80"> qui puoi scrivere il tuo testo </textarea> <input type="submit" value="invia"> </form> </div> Then here how tot insert to the DB the details (using the page articoli.php) $titolo = $_POST['titolo']; $sottotitolo = $_POST['sottotitolo']; $testo = $_POST['testo']; $description = "INSERT INTO curiosita (titolo,sottotitolo,testo) VALUES ('$titolo','$sottotitolo','$testo')"; //preparo la stringa per l'inserimento mysql_select_db($dbname); //effettuo l'inserimento sul database $Result1 = mysql_query($description) or die(mysql_error()); //effettuo l'inserimento sul database Later, I see it on a web page on my website, with a select function $nesql2 = "SELECT id,titolo,sottotitolo,testo FROM(SELECT id,titolo,sottotitolo,testo FROM curiosita ORDER by id DESC) a LIMIT 1"; $nentry2 = mysql_query ($nesql2); while ($new2 = mysql_fetch_row($nentry2)) { print $new2[1] ."</span><br>\n". $new2[2] . "</span><br>\n".$new2[3]; } } But this is only good to create everytime a new article. And anyone know or may suggest me how to -create an archive with links where to store automatically all the old articles? -create a template in php that give a new name to the new article using the title field.(this template i want to use everytime, i suppose it must be empty. How to fill it with the new data entered is my question. And how to generate a new html page with the new title?) thanks a lot in advance paolo Link to comment https://forums.phpfreaks.com/topic/194331-generating-html-pages-with-a-template-php-giving-a-title-automatically/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.