Php script for mail in a xhtml page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've to implement a php script in a web page to send mail.
If I use a .html form and a separate .php script, all works fine.
In the contrary, if I try to put the script into the .html file,
I've some troubles... Here's the code:

======================================================================
<?php
?>
<xml version="1.0" encoding="utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";><html
xmlns="http://www.w3.org/1999/xhtml";>

<head>
<meta name="generator" content="Quanta Plus" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>B#038;B #171;LA LOCANDA DI RE MANFREDI#187; - PALAZZO SAN
GERVASIO (PZ)</title>
<meta name="description" content="Ora c'#232; un Bed#038;Breakfast
anche
a Palazzo San Gervasio (PZ)" >
<meta name="keywords" content="b#038;b,bed#038;breakfast, Palazzo San
Gervasio, Potenza, Basilicata, Lucania" >
<link rel="stylesheet" type="text/css" href="layout.css" >
</head>
<body>

<ul class="navbar">
<li><a href="index.html">Home Page</a></li>
<li><a href="bed.html">Il nostro Bed#038;Breakfast</a></li>
<li><a href="paese.html">Il paese</a></li>
<li><a href="storia.html">La storia</a></li>
<li><a href="tradizioni.html">Le tradizioni</a></li>
<li><a href="indirizzi.html">Indirizzi utili</a></li>
</ul>

<h2>#200; possibile inviarci una comunicazione direttamente da questo
form</h1>
<h2>Riempire i campi richiesti e premere il pulsante "Invia"</h2>
<br /><br />

<?
if (isset($_POST['action']) && ($_POST['action']=='invia')) {
$receiverMail = "samiel@xxxxxxxxxxx";
$name = ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
$email = ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
$subject = ltrim(rtrim(strip_tags(stripslashes($_POST['subject']))));
$msg = ltrim(rtrim(strip_tags($_POST['msg'])));
$ip = getenv("REMOTE_ADDR");
$msgformat = "Messaggio da: $name ($ip)\nEmail: $email\n\n$msg";
if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
echo "<h3>Il messaggio non e' stato inviato</h3>
<h3>Si prega di compilare tutti i campi</h3";
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Nome:<br ><br >
<input name="name" size="50" maxlength="40" >
<br ><br/><br >
Indirizzo e-mail:<br /><br />
<input name="email" size="50" maxlength="40" >
<br ><br ><br >
Oggetto:<br ><br >
<input name="subject" size="50" maxlength="40" >
<br ><br ><br >
Messaggio:<br ><br >
<textarea name="msg" cols="50" rows="8"></textarea>
<br ><br ><br >
<input type="submit" value="Invia" >
#160; #160; #160; #160; #160; #160;
<input type="reset" value="Cancella" >
</form>
<?
}

elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z
{2,3})$", $email)) {
echo "<h3>Il messaggio non e' stato inviato</h3>
<h3>L'indirizzo e-mail indicato non e' valido</h3>";
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Nome:<br /><br />
<input name="name" size="50" maxlength="40" value=?> echo $name. <?">
<br /><br /><br />
Indirizzo e-mail:<br /><br />
<input name="email" size="50" maxlength="40" value="wrong!" >
<br /><br /><br />
Oggetto:<br /><br />
<input name="subject" size="50" maxlength="40" value="?>echo $subject;<?>
<br /><br /><br />
Messaggio:<br /><br />
<textarea name="msg" cols="50" rows="8">?> echo $message;<?</textarea>
<br /><br /><br />
<input type="submit" value="Invia" >> #160; #160; #160; #160;
#160; #160;
<input type="reset" value="Cancella" >
</form>
<?
}
else {
mail($receiverMail, $subject, $msgformat, "From: $name <$email>");
echo "<h3>Il messaggio e' stato inviato correttamente<h3>
<h3>Risponderemo il piu' presto possibile</h3>
<h3>Grazie di averci scritto</h3>"; }

}
?>
</body>
</html>
======================================================================

When I try to open the page, I receive this error:

Parse error: syntax error, unexpected T_STRING 
in /var/www/netsons.org/samiel/form2.php on line 79

Do u see my error?
Thanx!
MS



-- 
linux user no.: 353546
public key at http://keyserver.linux.it

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux