Errors code and wont work in PHP
I did post something earlier put this time I am going to post all of it.I am getting error message and it will not show up when i try to pull it up on local host. Here's the code:
This one is includeindex.php
if ($_POST['submit'] != "") {
if ($_POST['name'] != "") {
session_start();
$_SESSION['name'] = $_POST['name'];
TopNavigation("PHP Includes Example - ECA236", "PHP Includes", $_SESSION['name']);
} else {
header("Location:includindex.php");
exit;
}
} else {
TopNavigation("PHP Includes Example - ECA236", "PHP Includes");
echo "<div class="formtable">n";
echo "<br>";
echo "<form action="" . $PHP_SELF . "" method="post">n";
echo "Please enter your name:<input type="text" name="name">n";
echo "<input type="submit" class="btnSubmit" value="Enter" name="submit">n";
echo "</form>n";
echo "<br>";
echo "</div>n";
Footer();
}
?>
This one is header
<?php
function TopNavigation($pagetitle, $pageheading, $username = '') {
echo "<html>n";
echo " <head>n";
echo " <title>" . $pagetitle . "</title>n";
echo " <link href="../style.css" type="text/css" rel="stylesheet">";
echo " </head>n";
echo " <body>";
echo " <h1>" . $pageheading . "</h1>n";
echo " <hr>n";
echo " <p class="tiny">" . date("F j,Y") . "</p>";
if ($username != '') {
echo "<div align="center">n";
echo "<a href="includeindex.php">Use a different name</a> | <a href="about.php">About</a> | <a href="signout.php">Signout</a>n";
echo "</div>n";
echo "<p>Welcome. " . $username . "!";
}
}
function Footer() {
echo "</body>n";
echo "</html>n";
}
?>
This one is about.php
<?php
session_start();
include("include/header.php");
if (!isset($_SESSION['name'])) {;
header("Location:includeindex.php");
exit;
} else {
TopNavigation("About Me -ECA236", "About Me", $_SESSION['name']);
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>"n;
echo " < p>I been married for 5 years but been with my husband for 11 years </p > "n;
echo "<p > I am attending college for Computer Programming and Database Mangament </p > "n;
echo "<p > After I get done with this degree I am want to go back for Web Design </p > "n;
echo "<p > since half my classes are web design now . I enjoy camping,bon fires and </p > "n;
echo "<p > playing video games, hanging out with friends and family .</p > "n;
Footer();
}
?>
This one is signout.php
<?php
session_start();
if (isset($_SESSION['name'])) {
session_destroy();
session_start();
}
header("Location:includeindex.php");
exit;
?>
I can not get it to show up and work at all. I have no clue why it is not doing it. Can someone please help me.
I keep getting errors no matter what I fixed and it doesnt show up when you look at it online..
here the errors i get: Notice: Undefined variable: PHP_SELF in C:wampwwwincludeindex.php on line 19 Undefined index: submit in C:wampwwwincludeindex.php on line 4 Warning: include(include/header.php) [function.include]: failed to open stream: No such file or directory in C:wampwwwabout.php on line 3 Warning: include() [function.include]: Failed opening 'include/header.php' for inclusion (include_path='.;C:phppear') in C:wampwwwabout.php on line 3 Fatal error: Call to undefined function TopNavigation() in C:wampwwwabout.php on line 9
All of your echo
statements in the TopNavigation()
function are still incorrectly quoted. Instead of "n;
, they should end with n";
// Wrong
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>"n;
// Should be:
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>n";
---^^^^
在您的php.ini中将display_errors = Off更改为display_errors = On
链接地址: http://www.djcxy.com/p/69662.html上一篇: Php语法错误问题
下一篇: 错误代码,并不会在PHP中工作