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.