Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Problema con semplice form newsletter

    Salve a tutti, sono un super novizio e sto modificando un sito molto semplice, vorrei inserire un piccolo form per far lasciare la propria email per una newsletter.
    Ho provato con vari script php che ho trovato in rete.
    Su questo in particolare ho proceduto così. Ho salvato i files (.php e .html) nella cartella www del wampserver.
    Dopo aver inserito nel file .php la mia mail per fare una prova ho lanciato l'html e compilato l'unico campo.
    Mi riporta sempre questo errore:
    Parse error: syntax error, unexpected end of file in C:\wamp64\www\newsletterphp\NLprocess.php on line 49

    Questa riga è in bianco perché il codice finisce alla riga 48 con la classica chiusura ?>

    I file in questione li ho scaricati qui http://www.sendblaster.com/it/suppor...ulo-single-opt
    ed è il primo modulo in alto

    Spero possiate aiutarmi a capire dove ho sbagliato. Di seguito inserisco il codice sia .php che HTML

    <?php


    // Hello! welcome to the settings page.
    // Here's your two steps guide:


    // FIRST:
    // Instead of newsletter@test.com put the email address of the mailing list,
    // (the same that SendBlaster uses in Manage Subscriptions Section)
    // ... please pay attention to the ' ' apostrophes, they must remain around the email address.


    $emailmanager = 'miaemail@gmail.com';


    // SECOND:
    // save this file, and close it. Thank you!




    error_reporting(0);


    $email = trim($_POST['email']);
    $Ok = ereg("^([a-zA-Z0-9_\.-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email);
    if ($Ok) {
    mail($emailmanager,'Subscribe','','From: '.$email);


    if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
    {
    ?>
    <script language = 'javascript'>
    alert('Thank you, your address was added to our Mailing List');
    history.go(-1);
    </script>
    <?
    exit();
    }
    }


    else {
    if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
    {
    ?>
    <script language = 'javascript'>
    alert('Sorry, please provide a valid Email address.');
    history.go(-1);
    </script>
    <?
    exit();
    }
    }
    ?>

    HTML

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="NL-style.css" rel="stylesheet" type="text/css">


    </head>
    <body>


    <!-- Hello! If you like this STYLE for your mail form... -->


    <!-- CUT AFTER THIS LINE, and paste it inside your BODY tags -->


    <link href="NL-style.css" rel="stylesheet" type="text/css">
    <form name="form1" method="post" action="NLprocess.php" class="bk">
    <fieldset>
    <p align="center" class="txt">Subscribe E-mail:<br>
    <input name="email" type="text" size="12" class="txtbox">
    <input type="submit" name="Submit" value="Go" class="button">
    <br>
    our <a href="http://www.sendblaster.com/newsletter-software-no-recurring-fees/" title="newsletter software">Newsletter
    software</a></p>
    </fieldset>
    </form>


    <!-- END CUT BEFORE THIS LINE -->


    </body>
    </html>




    Grazie a tutti.

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2016
    Messaggi
    7
    Ciao, iniziamo dalle basi: un semplice form html con un campo di testo e un submit.
    HTML:
    <form action="action.php" method="post">
    Inserisci la mail: <input type="email" name="email"><input type="submit">
    </form>

    PHP: (il file si chiama action.php)
    <?php
    $email = $_POST["email"];
    //quindi ti ritrovi ad avere la mail dell'utente nella variabile $email, poi ne fai quello che ne hai voglia
    ?>
    Dove intendi salvare l'email? In un database?

  3. #3
    Quell'errore viene generato quando vengono omessi gli identificatori di fine istruzione.
    Ad esempio:
    } -> per le funzioni.
    ?> -> per i script php.

    Comprimi tutte le strutture con i tool dell'editor e guarda se vengono collassate correttamente.

    Ciao

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.