2012-01-04 7 views
-2

私はこのページの先生から得たPHPスクリプトを使用しました。 しかし、私は非常にPHPで経験していないので、私はそれを理解することはできません。 私はまだ電子メールが送信されるアドレスを設定する必要がありますが、どこでそれを行うのか分かりません。 私は「メール」でそれを記入する必要があると思っていましたが、今はメッセージを送信できないと言います。 これは私のホスト/サイト/何かに問題があるのですか?それとも私はまだコーディングに何か間違っていますか?PHP mailformはメールで送信しますか?

<!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><TITLE>www.lucsenden.nl - Voor al uw videoproducties.</TITLE> 

<META content="text/html; charset=utf-8" http-equiv=Content-Type> 

<META name=robots content=index,follow> 

<META name=keywords content=" "> 

<META name=description content=" "> 

<META content=0 http-equiv=Expires><LINK rel=stylesheet type=text/css href="style.css" media=screen> 

<script type="text/javascript" src="js/jquery-1.4.2.js"></script> 
<!--[if IE]> 
<link type="text/css" href="css/ie.css" rel="stylesheet" media="screen" /> 
<![endif]--> 
<!--[if IE 6]> 
<script type="text/javascript" src="js/pngfix.js"></script> 
<script type="text/javascript"> 
DD_belatedPNG.fix('img,#logo'); 
</script> 
<![endif]--> 

<LINK rel=stylesheet type=text/css href="css/ie.css" media=screen> 

</HEAD> 

<BODY> 

<DIV class=top-bar-wrap>&nbsp;</DIV> 

<DIV class=main-bg> 

<DIV id=sub-page class=main-wrap> 

<DIV id=header class=mod-con> 

<H1 id=logo><A href="/#"><IMG alt="" src="/image/luc.png"></A></H1> 

<UL id=main-menu> 

<LI><A href="/index.html"><STRONG>Home</STRONG></A><A class=cur href="/about.html"><STRONG>Over mij</STRONG></A> </LI> 

<LI><A href="/diensten.html"><STRONG>Diensten</STRONG></A> </LI> 

<LI><A href="/portfolio.html"><STRONG>Portfolio</STRONG></A> </LI> 

<LI><A href="/referenties.html"><STRONG>Referenties</STRONG></A> </LI> 

<LI><A href="/contact.html"><STRONG>Contact</STRONG></A> </LI></UL></DIV> 

<DIV id=main class=mod-con> 

<DIV class="container clearfix"> 

<DIV style="WIDTH: 861px;HEIGHT: 1006px" id=about-page class=main-con> 

<DIV class=title-nav> 

<H2>Contact</H2></DIV> 

<DIV class=content> 

<P>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam et risus non arcu porttitor feugi at in at neque. In hac habitasse platea dictumst. Proin pretium neque at turpis fermentum de aliquet. Ut risus nisi, scelerisque in convallis et, volutpat malesuada elit. Ut nulla libero, condi entum eget scelerisque eget, blandit sit amet metus. Suspendisse potenti. Nulla luctus temus augue dictum cursus. Curabitur non risus dui. In sit amet tellus in lacus fringilla condimentuma t sit amet libero. Fusce purus ligula, hendrerit ut vulputate eget, vestibulum non diam. Vestib ulum facilisis, leo id volutpat vestibulum, eros ligula ornare urna, pellentesque laoreet magna purus ac metus. Nulla facilisi.</P> 
<?php 

echo ''; 

if(isset($_POST['submit'])) { 

    $subject = $_POST['naam'].' stuurde een mail via PHP!'; 
    $email = $_POST['']; 
    $bericht = wordwrap($_POST['bericht'], 70); 

    $versturen_gelukt = mail($email, $subject, $bericht); 

    if($versturen_gelukt) { 
     echo '  <p>De email is verstuurd! <a href="'.$_SERVER['PHP_SELF'].'">Nog een mail sturen</a>.</p>'."\r\n"; 
    } else { 
     echo '  <p>Er is iets mis gegaan, <a href="'.$_SERVER['PHP_SELF'].'">probeer het opnieuw</a>.</p>'."\r\n"; 
    } 

} else { 

    echo ' 
    <form action="'.$_SERVER['PHP_SELF'].'" method="POST" type="text/plain"> 

     <label for="name">Naam</label> 
      <input type="naam" name="naam" id="naam" /> 

     <label for="email">Email</label> 
      <input type="email" name="email" id="email" /> 

     <label for="bericht">Bericht</label> 
      <textarea name="bericht" id="bericht"></textarea> 

     <label for="submit"></label> 
      <input type="submit" name="submit" id="submit" value="Stuur bericht!" /> 

    </form> 
    '; 
} 

echo ' '; 

?> 
</DIV></DIV></DIV></DIV></DIV></DIV> 

<DIV class=siteintro-wrap>&nbsp;</DIV> 
<DIV class=footer-wrap> 
    <DIV id=footer class=mod-con> 
    <DIV class=copyright>&#169 2012 Copyright All Rights Reserved. 
    </DIV> 
     <DIV class=hovergallery> 
     <a href="http://facebook.com/lucsenden"><img src="http://i44.tinypic.com/10p9g5i.png" /></a> 
     <a href="http://youtube.com/luckske112"><img src="http://i44.tinypic.com/34rwqdv.png" /></a> 
     <a href="http://twitter.com/lucsenden"><img src="http://i42.tinypic.com/xfst8g.png" /></a> 
     </DIV> 
    </DIV></DIV></BODY></html> 
    '; 

?> 
+1

ようこそStackOverflow。誰かがWebサイトにアクセスすると、WebサーバーはPHPコードを解析し、生成した出力を返します。したがって、サイトのソースを表示しようとすると、生成された出力が表示されます。これは、基本となるPHPコードではありません。質問を編集して、ソースコードをもう一度追加する必要があります。また、[phpの 'mail()'関数のマニュアル](http://php.net/mail)もチェックしてください。 – kba

+1

いいえ、あなたのページのPHPソースが見つかりません。質問を編集し、コードを貼り付けて選択し、ツールバーの '{}'ボタンを押してコードとしてマークします。 – deceze

+0

コードを変更しました。申し訳ありません。私は今クリスチャンが私に与えたリンクを読むつもりです。 – Jane

答えて

3

あなたは

$email = $_POST['[email protected]']; 

を書いているこれは基本的に$email変数(受信者)は[email protected]という名前のフィールドが含まれているものは何でもコンテンツに設定されていることを意味します。これはフィールド名にとって非常に奇妙な名前であり、幸いにもそのようなフィールド名はありません。

代わりに、あなたはメールアドレスは、メールの受信者になることを

$email = "[email protected]"; 

を記述する必要があります。

関連する問題