ANTICHAT

ANTICHAT (https://forum.antichat.io/index.php)
-   PHP (https://forum.antichat.io/forumdisplay.php?f=37)
-   -   send.php - Parse error (https://forum.antichat.io/showthread.php?t=132391)

Lionis 31.07.2009 23:19

send.php - Parse error
 
помогите решить проблему ... письмо не отправляется .
Код HTML:

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/lionis/public_html/send.php on line 2
---

PHP код:


<?php
if (isset($_POST['$1'])) {$1 = $_POST['$1'];}
if (isset(
$_POST['$2'])) {$2 = $_POST['$2'];}
if (isset(
$_POST['$3'])) {$3 = $_POST['$3'];}
if (isset(
$_POST['$4'])) {$4 = $_POST['$4'];}
if (isset(
$_POST['$5'])) {$5 = $_POST['$5'];}
if (isset(
$_POST['$6'])) {$6 = $_POST['$6'];}
if (isset(
$_POST['$7'])) {$6 = $_POST['$7'];}
if (isset(
$_POST['$8'])) {$6 = $_POST['$8'];}
if (isset(
$_POST['$9'])) {$6 = $_POST['$9'];}
if (isset(
$_POST['$10'])) {$6 = $_POST['$10'];}
if (isset(
$_POST['$11'])) {$6 = $_POST['$11'];}

$address = 'test@inbox.ru';
$sub = "тема";
$mes = "имя: $1 \2: $2 \ 3: $3 \ 4: $4 \5: $5 \6: $6 \7: $7 \8: $8 \9: $9 \10: $10 \11: $11";
$verify = mail ($address,$sub,$mes,"Content-type:text/plain; 

charset = windows-1251\r\nFrom:
$email");
if (
$verify == 'true')
{
echo 
"<p>cообщение отправлено";
}
else 
{
echo 
"<p>не отправлено";
}
?>


GreenBear 31.07.2009 23:38

http://ru.php.net/manual/en/language.variables.basics.php

[QwyZ] 01.08.2009 11:45

if (isset($_POST['$1'])) {$1 = $_POST['$1'];}

-->

if (isset($_POST['1'])) {$1 = $_POST['1'];}

t0wer 01.08.2009 12:31

Там же написано в ошибке... переменные не могут содержать название начинающееся с цифры!!!

латинского алфавита не хватило?

PHP код:

<?php
if (isset($_POST['a1'])) {$a1 = $_POST['a1'];}
if (isset(
$_POST['a2'])) {$a2 = $_POST['a2'];}
if (isset(
$_POST['a3'])) {$a3 = $_POST['a3'];}
if (isset(
$_POST['a4'])) {$a4 = $_POST['a4'];}
if (isset(
$_POST['a5'])) {$a5 = $_POST['a5'];}
if (isset(
$_POST['a6'])) {$a6 = $_POST['a6'];}
if (isset(
$_POST['a7'])) {$a7 = $_POST['a7'];}
if (isset(
$_POST['a8'])) {$a8 = $_POST['a8'];}
if (isset(
$_POST['a9'])) {$a9 = $_POST['a9'];}
if (isset(
$_POST['a10'])) {$a10 = $_POST['a10'];}
if (isset(
$_POST['a11'])) {$a11 = $_POST['a11'];}

$address = 'test@inbox.ru';
$sub = "тема";
$mes = "имя: $a1 \2: $a2 \ 3: $a3 \ 4: $a4 \5: $a5 \6: $a6 \7: $a7 \8: $a8 \9: $a9 \10: $a10 \11: $a11";
$verify = mail ($address,$sub,$mes,"Content-type:text/plain; charset = windows-1251\r\nFrom:$email");

if (
$verify == 'true') echo "<p>cообщение отправлено</p>";
else echo 
"<p>не отправлено</p>";
?>

P.S. Спасибо -=Zhenek=- поправил, а то я сослепу в пост переменную засунул!

imajo.ati 01.08.2009 13:20

$_POST['$1'] обрабатывает нормально =)

Lionis 01.08.2009 13:36

ничего на почту не приходит ...

-=Zhenek=- 01.08.2009 13:50

PHP код:

<?php 
if (isset($_POST['a1'])) {$a1 = $_POST['a1'];} 
if (isset(
$_POST['a2'])) {$a2 = $_POST['a2'];} 
if (isset(
$_POST['a3'])) {$a3 = $_POST['a3'];} 
if (isset(
$_POST['a4'])) {$a4 = $_POST['a4'];} 
if (isset(
$_POST['a5'])) {$a5 = $_POST['a5'];} 
if (isset(
$_POST['a6'])) {$a6 = $_POST['a6'];} 
if (isset(
$_POST['a7'])) {$a7 = $_POST['a7'];} 
if (isset(
$_POST['a8'])) {$a8 = $_POST['a8'];} 
if (isset(
$_POST['a9'])) {$a9 = $_POST['a9'];} 
if (isset(
$_POST['a10'])) {$a10 = $_POST['a10'];} 
if (isset(
$_POST['a11'])) {$a11 = $_POST['a11'];} 

$address = 'test@inbox.ru'; 
$sub = "тема"; 
$mes = "имя: $a1 \2: $a2 \ 3: $a3 \ 4: $a4 \5: $a5 \6: $a6 \7: $a7 \8: $a8 \9: $a9 \10: $a10 \11: $a11"; 
$verify = mail ($address,$sub,$mes,"Content-type:text/plain; charset = windows-1251\r\nFrom:$email"); 

if (
$verify == 'true') echo "<p>cообщение отправлено</p>"; 
else echo 
"<p>не отправлено</p>"; 
?>

У меня все работает.


Время: 16:50