1.

Solve : syntax error in php?

Answer»

Dear sirs,

I got this message while I was trying to insert a php script:

Parse error: syntax error, unexpected T_IF in /hsphere/local/home/clubscan/articaviaggi.com/processForm.php on line 8

The line 8 is (I think):

if ($COGNOME == "") { $errore .= "

  • Devi inserire il cognome
  • "; }

    and all the block is:

    $errore = ""
    if ($nome == "") { $errore .= "
  • Devi inserire il nome
  • "; }
    if ($cognome == "") { $errore .= "
  • Devi inserire il cognome
  • "; }
    if ($telfisso == "") { $errore .= "
  • Devi inserire il telefono fisso
  • "; }
    if ($email == "") { $errore .= "
  • Devi inserire l'indirizzo email
  • "; }

    //Se la VARIABILE errore NON è vuota (ovvero almeno uno dei campi obbligatori
    // è stato lasciato vuoto) visualizzo un messaggio di errore
    if $errore <> "" {
    //Creo una lista puntata CON class ERRORS dove con il css posso
    //dare un carattere rosso e la inserisco in una variabile
    $stampaErrori = '
      ';
      $stampaErrori .= $errore;
      $stampaErrori .= "
    ";

    (all the comments are in italian)
    Many thanks if you can help me to find the error.

    Regards

    Benedetto
    No problem. You have a semi colon missing. The line that says:

    $errore = ""

    should say:

    $errore = "";Hi Robpomeroy and thank you very much for your help!

    I did as you said but now i meet a new problem:

    Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /hsphere/local/home/clubscan/articaviaggi.com/processForm.php on line 16

    I am "new" in php programming and I hope you can help me aven now.

    This is the second part of the file, from line 8:

    $errore = "";
    if ($nome == "") { $errore .= "

  • Devi inserire il nome
  • "; }
    if ($cognome == "") { $errore .= "
  • Devi inserire il cognome
  • "; }
    if ($telfisso == "") { $errore .= "
  • Devi inserire il telefono fisso
  • "; }
    if ($email == "") { $errore .= "
  • Devi inserire l'indirizzo email
  • "; }


    //Se la variabile errore non è vuota (ovvero almeno uno dei campi obbligatori
    // è stato lasciato vuoto) visualizzo un messaggio di errore
    if $errore <> "" {
    //Creo una lista puntata con class errors dove con il css posso
    //dare un carattere rosso e la inserisco in una variabile
    $stampaErrori = '
      ';
      $stampaErrori .= $errore;
      $stampaErrori .= "
    ";

    //Stampo un riquadro con dentro la lista errori
    echo '';
    echo 'Attenzione!'
    echo $stampaErrori;
    echo '

    Torna indietro[/url]

    ';
    echo '

    ';
    } else {

    Best regards

    Benedetto
    You're welcome. Now; this line:

    if $errore <> "" {

    should read

    if ($errore <> "") {Now, it was so easy !
    Thanks a lot and have a nice day, Rob'
    Benedetto
    I only know because I've made the same errors myself many times.



    Discussion

    No Comment Found