0

PHP で連絡先フォームを作成しようとしていますが、送信すると次のエラーが表示されます: 解析エラー: 構文エラー、予期しない ')' in /home/aginther14/aginther14.interactivedesignlab.com/contact.php on line 7

PHP を初めて使用するのですが、どうすれば修正できますか? ありがとう。

<?php 
 $to = "gintherthegreat@gmail.com"; 
 $subject = "AdamGinther.com Message"; 
 $email = $_REQUEST['email'] ; 
 $message = $_REQUEST['message'] ; 
 $headers = "From: $email"; 
 $sent = mail($to, $subject, $message, $headers, $email,) ; 
 if($sent) 
 header("Location: contactconfirmed.html");
 else 
 {print "We encountered an error sending your mail"; }
 ?> 


<form name="contact" action="contact.php" method="post" autocomplete="off">
Name: <input type="text" name="Usersname"><br><br>
E-Mail: <input type="text" name="email"><br><br>
Comment:<br> <textarea name="message"></textarea><br><br>
<input type="submit" value="Send Me a Message!" id="button">

4

2 に答える 2

2

ライン No 7 は次のとおりです。

$sent = mail($to, $subject, $message, $headers, $email,) ;  
                                                      ^--- remove this comma

次のようになります。

$sent = mail($to, $subject, $message, $headers, $email) ;
于 2012-12-15T06:07:39.740 に答える
-1
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = "AdamGinther.com Message"; 
  $message = $_REQUEST['message'] ;
  mail("gintherthegreat@gmail.com", $subject,
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='contact.php'>
  Email: <input name='email' type='text'><br>
  Subject: <input name='subject' type='text'><br>
  Comment:<br>
  <textarea name='message' rows='15' cols='40'>
  </textarea><br>
  <input type='submit'>
  </form>";
  }
?>
于 2012-12-15T06:11:52.227 に答える