请求帮助Php

时间:2014-03-13 17:56:49

标签: php

大家好,晚上好,我想得到一些关于这个代码的帮助我尝试(我的头第一个php& Mysql回家:)不管怎样我一直试图找到问题,但似乎,我'我没有关闭主题标签我不知道要做什么。我是新手。

    <?php

$when_it_happend = $_POST['whenithappend'];

$how_long = $_POST['howlong'];

$alien = $_POST['alien'];

$sawdog = $_POST['sawdog'];

$email = $_POST['email'];

$other = $_POST['other'];





     $to = 'email@.com';
    $subject = 'Aliens Abducted Me -  Abduction Report';
    $msg = "$when_it_happend  And was gone for $how_long.\n" .
        "Alien description: $alien\n" .
        "Was Fang there: $sawdog\n" .
        "Other comments: $other;
    mail($to, $subject, $msg, 'From:' . $email);

echo 'Thanks for submitting the form <br />';

echo 'You were abducted' . $when_it_happend;

echo 'And were gone for' . $how_long . '<br />';

echo 'Describe them:' . $alien . '<br />';

echo 'Was Fang there?' . $sawdog . '<br />';

echo 'Your email adress is' . $email;

echo 'Anything els you like to add' . $other;



    ?>

2 个答案:

答案 0 :(得分:1)

$to = 'email@.com';

$subject = 'Aliens Abducted Me - Abduction Report'; 
$msg = "$when_it_happend And was gone for $how_long.\n" . "Alien description: $alien\n" . "Was Fang there: $sawdog\n" . 
"Other comments: $other"; 
mail($to, $subject, $msg, 'From:' . $email);

错误:$ msg没有关闭。它需要一个&#34 ;;在$ other之后

答案 1 :(得分:1)

您没有在此行中关闭引号:

"Other comments: $other;

试试这样:

$to = 'email@.com';
$subject = 'Aliens Abducted Me -  Abduction Report';
$msg = "$when_it_happend  And was gone for $how_long.\n" .
    "Alien description: $alien\n" .
    "Was Fang there: $sawdog\n" .
    "Other comments: $other";
mail($to, $subject, $msg, 'From:' . $email);