Pagina 2 di 3 primaprima 1 2 3 ultimoultimo
Visualizzazione dei risultati da 11 a 20 su 27

Discussione: Gestione news

  1. #11
    Non capisco come faccio mi ero già letto quel pezzo ma non fare mi aiuti

  2. #12
    posta il pezzo di codice relativo al form e io ti faccio tutto il resto...
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  3. #13
    Eccolo


    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
     <title>Untitled</title>
    </head>
    <body>
    Titolo: 
    
    <input type=TEXT>
    
    
    Testo per la News:
    
    <textarea name=news" rows=10 cols=60>
    </textarea>
    
    
    </body>
    </html>

  4. #14
    Questo ops

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
     <title>Invio News</title>
    </head>
    <body>
    Titolo: 
    
    <input type=TEXT>
    
    
    Testo per la News:
    
    <textarea name=news" rows=10 cols=60>
    </textarea> 
    
    <input type="submit" value="Invia">   <input type="reset">
    
    
    </body>
    </html>

  5. #15
    questo non è un form...

    devi fare così:

    <form method="post" action="aggiungi.php">

    Titolo:

    <input type="text" size="30" name="titolo">


    Testo per la News:

    <textarea name="news" rows=10 cols=60>
    </textarea>


    <input type="submit" value="Invia">
    </form>

    poi crei un file chiamato aggiungi.php... però prima di passare a questa fase... hai creato la tabella delle news ? se la risposta è no (come immagino) prima bisogna fare quello... e per poter fare tutto ciò è necessario configurare il db (tramite CPanel) e creare un utente... è chiaro che questo non lo posso fare io via forum...
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  6. #16
    La tabella lo creata nel db in locale ed ho chiamato il database News e la tabella news ok??

  7. #17
    il codice da mettere in aggiungi.php è:

    $db_host = "localhost";
    $db_user = "****tuo username ****";
    $db_password = "**** tua password ****";
    $db_name = "**** nome del db ****";

    $db = mysql_connect($db_host,$db_user,$db_password);
    if ($db == FALSE) die ("Errore durante la connessione al database: ".mysql_error());

    mysql_select_db($db_name,$db) or die ("Errore nella selezione del database: ".mysql_error());

    $query = "INSERT INTO ***nome tabella*** (titolo,news) VALUES ('$titolo','$news')";
    mysql_query($query,$db);

    mysql_close($db);

    sostituisci al posto dei campi con **** xxx **** i valori corretti.
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  8. #18
    Si ma qui per fare la teabella mi chiede di mettere i campi che metto??

  9. #19
    devi fare un campo chiamato id che deve essere auto_increment e chiave primaria, poi metti due campi testuali uno chiamato titolo e l'altro news.
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  10. #20
    Allora io ho fatto così
    nella pagina aggiungi_news.html o messo questo

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
     <title>Aggiungi news</title>
    </head>
    <body>
    <form method="post" action="aggiungi.php">
    
    Titolo: 
    
    <input type="text" size="30" name="titolo">
    
    
    Testo per la News:
    
    <textarea name="news" rows=10 cols=60>
    </textarea>
    
    
    <input type="submit" value="Invia">
    </form>
    
    
    </body>
    </html>
    In aggiungi.php
    o messo questo

    codice:
    <?php
    $db_host = "localhost";
    $db_user = "root";
    $db_password =" ";
    $db_name = "News";
    
    $db = mysql_connect($db_host,$db_user,$db_password);
    if ($db == FALSE) die ("Errore durante la connessione al database: ".mysql_error());
    
    mysql_select_db($db_name,$db) or die ("Errore nella selezione del database: ".mysql_error());
    
    $query = "INSERT INTO news (titolo,news) VALUES ('$titolo','$news')";
    mysql_query($query,$db);
    
    mysql_close($db);
    
    ?>
    é giusto poi ho fatto la tabella news con tre campi id Titolo ed News con cami text ed id int 11 giusto??

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.