Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043

    non riesco a collegare php all'html

    con php mailer vorrei inviare una email, posto la parte iniziale del codice:
    le prime variabili collegate all'html funzionano, come ad esempio '.$rowutente["ragione_sociale"].'

    se invece collego più codice php non funziona più, ad esempio

    '.
    while($rowrisposte=mysql_fetch_array($result_rispo ste)){

    $idcorsieventodomande = $rowrisposte["id_corsi_evento_domande"];
    .'

    perchè


    Codice PHP:
    $html_body '
    <html>
    <head>
    <style>
    .testo1{text-align:right;color: #CF150E; FONT-FAMILY: Verdana; FONT-SIZE: 15px; TEXT-DECORATION: none; font-weight:bold}
    .testo2{text-align:right;color: #000000; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
    .testo3{text-align:right;color: #666666; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:link          {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:active        {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:visited       {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:hover         {BACKGROUND: none; COLOR: #000000; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    </style>
    </head>
    <body>

    <table width="700" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="right" background="http://www.adamis.it/images/fondo_email.jpg">

    <table width="680" height="600" border="0" cellpadding="0" cellspacing="0">
     <tr>
            <td width="660" height="160"></td>
             <td width="20" rowspan="16"></td>
          </tr>
          <tr>
            <td height="50" align="right" class="testo1">

    Gentile '
    .$rowutente["ragione_sociale"].''.$rowutente["nome"].' '.$rowutente["cognome"].'

            abbiamo ricevuto correttamente il tuo test.</p>
            

    A seguire le tue risposte:</p></td>
          </tr>
          <tr>
            <td height="5" align="right"></td>
          </tr>
          
          
    '
    .while($rowrisposte=mysql_fetch_array($result_risposte)){

    $idcorsieventodomande $rowrisposte["id_corsi_evento_domande"];.

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043
    mi da quest'errore qua:

    Parse error: syntax error, unexpected T_WHILE in /web/htdocs/www.sito.it/home/pann_contr_comune/include_utente_query_corsi.php on line 575

    alla riga 575 c'è questo:


    '. while($rowrisposte=mysql_fetch_array($result_rispo ste)){

  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043
    aiuto per favore, se non ce riesco me licenziano!!!

  4. #4
    A lume di naso.
    Togli il punto prima del WHILE metti il punto e virgola e vai a capo.
    Hai un altro errore successivo.

    Codice PHP:
    $html_body 
    <html> 
    <head> 
    <style> 
    .testo1{text-align:right;color: #CF150E; FONT-FAMILY: Verdana; FONT-SIZE: 15px; TEXT-DECORATION: none; font-weight:bold} 
    .testo2{text-align:right;color: #000000; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold} 
    .testo3{text-align:right;color: #666666; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold} 
    a.testo3:link          {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold} 
    a.testo3:active        {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold} 
    a.testo3:visited       {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold} 
    a.testo3:hover         {BACKGROUND: none; COLOR: #000000; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold} 
    </style> 
    </head> 
    <body> 

    <table width="700" height="10" border="0" align="center" cellpadding="0" cellspacing="0"> 
      <tr> 
        <td align="right" background="http://www.adamis.it/images/fondo_email.jpg"> 

    <table width="680" height="600" border="0" cellpadding="0" cellspacing="0"> 
     <tr> 
            <td width="660" height="160"></td> 
             <td width="20" rowspan="16"></td> 
          </tr> 
          <tr> 
            <td height="50" align="right" class="testo1">

    Gentile '
    .$rowutente["ragione_sociale"].''.$rowutente["nome"].' '.$rowutente["cognome"].'
     
            abbiamo ricevuto correttamente il tuo test.</p> 
            

    A seguire le tue risposte:</p></td> 
          </tr> 
          <tr> 
            <td height="5" align="right"></td> 
          </tr> 
    '
    ;

    while (
    $rowrisposte mysql_fetch_array($result_risposte)){ 
         
    $html_body .=  $rowrisposte["id_corsi_evento_domande"];

    Il while (di suo) non restituisce una stringa, quindi non lo puoi concatenare ad una stringa.
    Nel ciclo di WHILE devi creare una stringa che concateni alle precedenti (ecco il perché ho messo il nome variabile uguale alla precedente, seguito da PUNTO-UGUALE).

    Mi dispiacerebbe se ti licenziassero, quindi una mano te la do' volentieri.... mi viene da dire: se sei pagato per programmare in PHP, almeno le basi dovresti studiarle!
    Senza offese, eh: una mia constatazione!

    <ALCIO />
    Per cortesia: no PVT Tecnici
    ******* LINKS *******
    SRL
    MetalWave

  5. #5
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043
    no, no faccio il grafico editoriale, ora sto solo facendo il sito all'azienda dove lavoro, ma è una cosa una tantum.

  6. #6
    Beh.... le ultime righe della mia risposta erano solo una battuta!
    La cosa importante era il debug del tuo script.
    Funziona?
    <ALCIO />
    Per cortesia: no PVT Tecnici
    ******* LINKS *******
    SRL
    MetalWave

  7. #7
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043
    no



    forse non conosci phpmailer

  8. #8
    PHP Mailer lo conosco ma il tuo problema risiede da un'altra parte, non nella classe.
    Te non compili a dovere la variabile che poi passerai come HTML al metodo della classe che si occupa di inviare la mail.
    Quale problema hai ora???

    <ALCIO />
    Per cortesia: no PVT Tecnici
    ******* LINKS *******
    SRL
    MetalWave

  9. #9
    Originariamente inviato da prinzart
    no



    forse non conosci phpmailer
    Come risposta non mi sembra il massimo. Che errore ti da?
    "Mai discutere con un idiota. Ti trascina al suo livello e ti batte con l'esperienza." (Oscar Wilde)

  10. #10
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    2,043
    Grazie dell'aiuto,ecco il codice completo, se ci riesci sei un genio del php
    Non mi da nessun errore, ma mi invia una email vuota.
    Il codice è corretto, l'unico problema è che non riesco a collegare la parte php con l'html

    da qui in poi:
    <?php
    while($rowrisposte=mysql_fetch_array($result_rispo ste)){


    Codice PHP:
    // INIZIO SCRIPT PHPMAILER

    require "../phpmailer/class.phpmailer.php";
    $messaggio = new PHPmailer();

    //intestazioni e corpo dell'email
    $messaggio->From= ''.$rowutente["email"].'';
    $messaggio->FromName= ''.$rowutente["nome"].' '.$rowutente["cognome"].'';
    $messaggio->AddReplyTo(''.$rowutente["email"].''); 
    $messaggio->Subject="Riepilogo test";

    $messaggio->AddAddress("sito@sito.it");
    $messaggio->AddAddress(''.$rowutente["email"].''); 

    $messaggio->Sender= ''.$rowutente["email"].'';

    $messaggio->AddEmbeddedImage('/web/htdocs/www.sito.it/home/images/fondo_email.jpg', 'ciccio', 'fondo_email.jpg', 'base64', 'image/jpeg'); 

    //inseriamo i tag HTML e i CSS per formattare il messaggio
    $html_body = '
    <html>
    <head>
    <style>
    .testo1{text-align:right;color: #CF150E; FONT-FAMILY: Verdana; FONT-SIZE: 15px; TEXT-DECORATION: none; font-weight:bold}
    .testo2{text-align:right;color: #000000; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
    .testo3{text-align:right;color: #666666; FONT-FAMILY: Verdana; FONT-SIZE: 12px; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:link          {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:active        {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:visited       {BACKGROUND: none; COLOR: #666666; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    a.testo3:hover         {BACKGROUND: none; COLOR: #000000; FONT-SIZE: 12px; FONT-FAMILY: Verdana, Helvetica; TEXT-DECORATION: none; font-weight:bold}
    </style>
    </head>
    <body>

    <table width="700" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="right" background="http://www.sito.it/images/fondo_email.jpg">

    <table width="680" height="600" border="0" cellpadding="0" cellspacing="0">
     <tr>
            <td width="660" height="160"></td>
             <td width="20" rowspan="16"></td>
          </tr>
          <tr>
            <td height="50" align="right" class="testo1">

    Gentile '.$rowutente["ragione_sociale"].''.$rowutente["nome"].' '.$rowutente["cognome"].'

            abbiamo ricevuto correttamente il tuo test.</p>
            

    A seguire le tue risposte:</p></td>
          </tr>
          <tr>
            <td height="5" align="right"></td>
          </tr> 


          
        <?php  
    while($rowrisposte=mysql_fetch_array($result_risposte)){

    $idcorsieventodomande $rowrisposte["id_corsi_evento_domande"];

    echo 
    $idcorsieventodomande
    echo 
    $rowrisposte["domanda"]; 


    $query_risposte2="SELECT d_corsi_evento_domande.*, d_corsi_evento_risposte.* 

                    FROM d_corsi_evento_domande 
                
                    INNER JOIN d_corsi_evento_risposte
                    ON d_corsi_evento_domande.id_corsi_evento_domande = d_corsi_evento_risposte.id_corsi_evento_domande 
                    
                    AND d_corsi_evento_risposte.id_corsi_evento_domande = 
    $idcorsieventodomande";    
                    
    $result_risposte2=mysql_query($query_risposte2$conn) or die ("errore ".mysql_error());

    $rowrisposte2=mysql_fetch_array($result_risposte2); 
    ?>

          

    <tr>
            <td height="15" align="right" class="testo2">domanda: '.$rowrisposte["domanda"].'</td>
          </tr>


    <?php
        
    if ($rowrisposte2["risposta_ute"] == 1){
    ?>


    <tr>
            <td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_1"].'</td>
          </tr>


    <?php
          
    } elseif($rowrisposte2["risposta_ute"] == 2){
    ?>


    <tr>
            <td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_2"].'</td>
          </tr>
          
          
    <?php

           
    } elseif($rowrisposte2["risposta_ute"] == 3){
    ?>


    <tr>
            <td height="15" align="right" class="testo2">risposta: '.$rowrisposte["risposta_3"].'</td>
          </tr>


    <?php
           
    }
    ?>
          
          
    <tr>
            <td height="10"> </td>
          </tr>



    <?php
    }
    ?>
          
          
          
          <tr>
            <td height="15" align="right"> </td>
          </tr>
                <tr>
            <td height="15" align="right" class="testo1">

    </td>
          </tr>
          <tr>
            <td height="65" align="right"></td>
          </tr>
          <tr>
            <td height="10" align="right" class="testo3">
    Dopo che il nostro staff avrà controllato il tuo test ti invieremo una email con i risultati.



    Ti aspettiamo sul sito [url="http://www.sito.it"][url]www.sito.it[/url][/url]

    Con i nostri migliori saluti, 
    Servizio Clienti
    </td>
          </tr>
                <tr>
            <td></td>
          </tr>
        </table>

    </td>
      </tr>
    </table>

    </body> 
    </html> 
    '; 

    //settiamo il metodo che indica alla classe 
    //il formato HTML
    $messaggio->MsgHTML($html_body); 

    $messaggio->AltBody="Per poter leggere correttamente questo messaggio è indispensabile che il tuo client di posta elettronica sia abilitato per l'html";


    //parte relativa all'invio
    if(!$messaggio->Send()){ 
      echo $messaggio->ErrorInfo; 
    }else{ 
      echo '';
    }

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.