Kod
<?php
include("inc/header.php");
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'mientowy1@gmail.com'; // Adres e-mail adresata
$subject = 'Kontakt'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
$charset = 'iso-8859-2'; // Strona kodowa
//////////////////////////////
$head =
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
Nick
<input type="text" name="nick" value=""><br \><br \>
Email
<input type="text" name="nick" value=""><br \><br \>
Kod z SMS
<input type="text" name="kodzsms" value=""><br \><br \>
Złoże
<select name="Złoże" size="1">
<option>Diament</option>
<option>Złoto</option>
<option>Żelazo</option>
<option>Redstone</option><br \><br \>
<input type="submit" name="wyslij" value="Wyślij">
</select>
</form>
<?php
}
include("inc/footer.php");
?>
include("inc/header.php");
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'mientowy1@gmail.com'; // Adres e-mail adresata
$subject = 'Kontakt'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
$charset = 'iso-8859-2'; // Strona kodowa
//////////////////////////////
$head =
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
Nick
<input type="text" name="nick" value=""><br \><br \>
<input type="text" name="nick" value=""><br \><br \>
Kod z SMS
<input type="text" name="kodzsms" value=""><br \><br \>
Złoże
<select name="Złoże" size="1">
<option>Diament</option>
<option>Złoto</option>
<option>Żelazo</option>
<option>Redstone</option><br \><br \>
<input type="submit" name="wyslij" value="Wyślij">
</select>
</form>
<?php
}
include("inc/footer.php");
?>
Ale chciałbym jeszcze określić ramę w jakiej ma być formularz. Gdy pod linijką z include napiszę:
Kod
echo'<div class="tresc">
i linijkę nad "include("inc/footer.php")" wpiszę
Kod
</div>'
tak wygląda to po dodaniu:
Kod
<?php
include("inc/header.php");
echo'<div class="tresc">
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'mientowy1@gmail.com'; // Adres e-mail adresata
$subject = 'Kontakt'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
$charset = 'iso-8859-2'; // Strona kodowa
//////////////////////////////
$head =
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
Nick
<input type="text" name="nick" value=""><br \><br \>
Email
<input type="text" name="nick" value=""><br \><br \>
Kod z SMS
<input type="text" name="kodzsms" value=""><br \><br \>
Złoże
<select name="Złoże" size="1">
<option>Diament</option>
<option>Złoto</option>
<option>Żelazo</option>
<option>Redstone</option><br \><br \>
<input type="submit" name="wyslij" value="Wyślij">
</select>
</form>
<?php
}
</div>';
include("inc/footer.php");
?>
include("inc/header.php");
echo'<div class="tresc">
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'mientowy1@gmail.com'; // Adres e-mail adresata
$subject = 'Kontakt'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
$charset = 'iso-8859-2'; // Strona kodowa
//////////////////////////////
$head =
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form action="?" method="post">
Nick
<input type="text" name="nick" value=""><br \><br \>
<input type="text" name="nick" value=""><br \><br \>
Kod z SMS
<input type="text" name="kodzsms" value=""><br \><br \>
Złoże
<select name="Złoże" size="1">
<option>Diament</option>
<option>Złoto</option>
<option>Żelazo</option>
<option>Redstone</option><br \><br \>
<input type="submit" name="wyslij" value="Wyślij">
</select>
</form>
<?php
}
</div>';
include("inc/footer.php");
?>
Wyskakuje mi taki błąd : Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/virtual/cs-fragevolution.cba.pl/test/formzloze.php on line 7
Proszę o pomoc.
Pozdrawiam, mientowy