私はクラスのウェブページに取り組んでいます。新入生が興味のある専攻の情報を入手できるように設計されたサイトです。
課題のために、元の HTML コードを header.php、content.php、および footer.php に分割する必要があります。また、$ SERVER[PHP SELF] のアクションでフォームに POST メソッドを使用する必要があります。また、フォームで非表示の入力フィールドを使用する必要があります。
これらのタスクはすべて実行しましたが、ヒアドキュメントのプリントに何か問題があると思います <<
フォームでさらに作業を行う必要があることはわかっていますが、ページがヘッダー、コンテンツ、およびフッターで正しく読み込まれることを確認したいと思っています。何も見えないので、先に進んで他の関数を書き出すつもりはありません。私の PHP コードを見て、このバグを見つけるのを手伝ってくれませんか? 私は何かを見落としているだけだと確信していますが、助けていただければ幸いです!ありがとう!
Header.php:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>UNA Preview Day 2013</title>
<link rel="stylesheet" href="preview.css">
<script src="preview.js"></script>
</head>
<body>
Content.php:
<!-- Tell script impaired users we *must* have Javascript -->
<noscript>
<p class="alert">Sorry, this page requires Javascript!</p>
</noscript>
<img src= "banner.gif" alt = "UNA Logo" />
<br />
<h1>UNA Preview Day 2013</h1>
フッター.php
<div class = "image">
<img src = "unapic.png" alt = "UNA Logo" />
</div>
<p id = "footer">Copyright © 2013 | University of North Alabama</p>
</body>
</html>
Index.php:
<?PHP
require("header.php");
if ($_POST[_submit_check]) {
processForm();
}
else {
displayForm();
}
function displayForm() {
require("content.php");
}
require("footer.php");
if (array_key_exists('_submit_check', $_POST)) {
processForm();
}
else {
displayForm();
}
// ------------------------------------------------
function processForm() { //NEEDS WORK
print "Hello, $_POST[user]!";
}
function display_form() {
//require("content.php");
print <<<HTMLBLOCK
<html>
<head>
<title>UNA Preview Day 2013</title>
</head>
<body>
<form name = "contact" method = "POST" action="$_SERVER[PHP_SELF]">
<div class = "appearance">
*All fields required.*<br /><br />
Name: * <input title="Name required!" type = "text" id = "name" name = "name" required autofocus onchange = "validName();" size = 30>
<br />
Email: * <input title="Email address of form username@domain required!" type = "email" placeholder = "me@example.com" id = "email" name = "email"
required onchange = "validAddress();" size = 30>
<br /><br /><br />
Areas of Study <br />
Check the program(s) in which you are interested in. (*Check AT LEAST one.*) <br />
<input type = "checkbox" id = "cs" name = "option[]">Computer Science<br />
<input type = "checkbox" id = "cis" name = "option[]">Computer Information Systems<br />
<input type = "checkbox" id = "ddep" name = "option[]">Dual Degree Engineering Program<br /><br /><br />
<div class = "center">
<input type="button" value="Send" onClick = "return validOption()">
<input type="reset" value="Clear">
</div>
<input type = "hidden" name="_submit_check" value="1">
</div>
<br />
<br />
</form>
</body>
</html>
HTMLBLOCK;
}
?>