в свободное время занимаюсь быстрой веб-разработкой для салона модификации тела; Я пытаюсь настроить форму «Свяжитесь с нами», за исключением случаев, когда я нажимаю «Отправить», она просто возвращает die (); метод. Я не слишком уверен, что я делаю неправильно, потому что я привык к программированию на Java, и я просто получил бы метод ошибки для этого. Ха-ха. Мой код, как показано ниже, если кто-то может мне помочь, проблемная область находится в «контактном» случае.
<html>
<head>
<title>Darklite Tattoo & Piercing</title>
<link href="src/style.css" type="text/css" rel="stylesheet" /></link>
</head>
<body bgcolor="000048" />
<?php include("src/config.php"); ?>
<div align="center" /><img src="src/img/darklite_banner.jpg" /><br />
<div id="main" />
<?php echo("<a href=\"index.php\" />Home</a> · <a href=\"index.php?x=profiles\" />Profiles</a> · <a href=\"index.php?x=services\" />Services</a> · <a href=\"index.php?x=contact\" />Contact Us</a>"); ?>
<hr>
<?php
$x = $_GET['x'];
switch($x) {
case "profiles":
echo("Le profiles.");
break; case "services":
echo("Body piercings and tattoo's.");
break; case "contact":
if ($_POST["email"]<>'') {
$ToEmail = 'ihatejava@hotmail.com';
$EmailSubject = 'Site contact form ';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>
Your message was sent
<?php
} else {
?>
<form action="index.php?x=contact" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="29%" class="bodytext">Your name:</td>
<td width="71%"><input name="name" type="text" id="name" size="32"></td>
</tr>
<tr>
<td class="bodytext">Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext">Comment:</td>
<td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
</tr>
<tr>
<td class="bodytext"> </td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
<?php
};
break; default:
echo("Welcome to Darklite Tattoo & Piercing!");
break;
}
?>
</div>
</div>
</body>
</html>