Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804

    Inviare dati al database Mysql

    buon giorno ragazzi buon giorno moderatori vorrei chiedervi come si fa ad inviare dati ad un database3 vi spiego meglio io ho creato una mailing list e vorrei che mi salvi nel database nome e e-mail come si fa?

  2. #2
    Prima crei una tabella utenti

    codice:
    CREATE TABLE utenti (
       idUtente int(4) NOT NULL auto_increment,
       Nome varchar(20) NOT NULL,
       eMail varchar(20) NOT NULL,
       PRIMARY KEY(idUtente)
    );
    Poi tramite un form in HTML prendi i dati dell'utente e li inserisci nel database in questo modo:

    codice:
    INSERT INTO utenti VALUES(NULL, '$_POST[nome]', '$_POST[email]');
    Dove $_POST[nome] e $_POST[email] sono i dati acquisiti dal form con metodo POST.

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    ciao ti faccio vedere quale dati devo inviare al database
    Codice PHP:
    <?  

    $adminaddress 
    "info@xxxxxx.com"
    $siteaddress ="http://www.xxxxxx.com"
    $sitename "xxxxxxxx"

    //No need to change anything below ... 
    // Gets the date and time from your server
    $date date("m/d/Y H:i:s");

    // Gets the IP Address
    if ($REMOTE_ADDR == ""$ip "no ip";
    else 
    $ip getHostByAddr($REMOTE_ADDR);

    // Gets the POST Headers - the Flash variables
    $action $HTTP_POST_VARS['action'] ;
    $email $HTTP_POST_VARS['email'] ;
    $name $HTTP_POST_VARS['name'] ;


    //Process the form data!
    // and send the information collected in the Flash form to Your nominated email address

    if ($action == "send") {
        
    //
        
    mail ("$adminaddress","informazioni",
        
    "Il visitatore ha lasciato le seguenti informazioni \n
        Name: 
    $name 
        Email: 
    $email\n

        
        Logged Info :
        ------------------------------
        Using: 
    $HTTP_USER_AGENT
        Hostname: 
    $ip
        IP address: 
    $REMOTE_ADDR
        Date/Time:  
    $date","FROM:$email) ; 
        
        
    //This sends a confirmation to your visitor
        
    mail ("$email","Re:"
        
    "Salve $name,\n
        Per confermare l'iscizione alla Newsletter Le basta cliccare sul link sottostante 
    $siteaddress/homeita/mailinglist/conferma.php?email=$email&name=$name\">.\n
     
         Saluti dallo Staff di 
    $sitename 
         

        
    $siteaddress","FROM:$adminaddress ") ; 
        
        
    //Confirmation is sent back to the Flash form that the process is complete
        
    $sendresult "Thank you. You will receive a confirmation email shortly.";
        
    $send_answer "answer=";
        
    $send_answer .= rawurlencode($sendresult);
        echo 
    $send_answer;
    //


    ?>

  4. #4
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    e il collegamento al database come si fa?

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 © 2025 vBulletin Solutions, Inc. All rights reserved.