Reputation: 13
I have an index.php page in which, there is a login form.
Index.php:
<?php include_once("include/header.php");?>
</head>
<body>
<div class="mainContainer">
<div class="header"><!--Header start-->
<!--Inlcluding Login Barr-->
<?php include("include/loginBar.php");?>
<div class="clear"></div>
</div><!--Header end-->
<div class="centerContent"><!--Center content start-->
</div><!--center content end-->
<div class="clear"></div>
<?php include("include/footer.php");?>
</div>
</body>
</html>
header.php:
<?php session_start();
ob_start();
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/mainStylesheet.css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
footer.php
<? ob_end_flush(); ?>
loginBar.php
<div class="loginBar">
<form name="Login" id="Login" action="actions.php" method="post">
<span class="label">Login</span>
<input type="text" name="name" id="username" value="Username" onBlur="if(this.value==''){this.value=this.defaultValue;}" onFocus="if(this.value==this.defaultValue){this.value='';}" />
<input type="password" name="password" id="userpassword" value="Password" onBlur="if(this.value==''){this.value=this.defaultValue;}" onFocus="if(this.value==this.defaultValue){this.value='';}"/>
<input class="loginButton" id="loginButton" type="submit" value="Go" />
<input type="hidden" value="loginValues" name="login" id="login"/>
</form>
</div>
actions.php
<?php session_start();
echo $_POST['name']; echo $_POST['password'];
if(isset($_POST['login']) && $_POST['login']=="loginValues"){
echo "HAHAHAHAHA";
}
?>
The problem is, form values are echoed outside the IF block in actions.php page, but nothing works inside this block. That means form values are successfully transferred.
In firebug console, I see an error stating "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol."
I have tried all options and have placed this line after HEAD tag :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
, but nothing works.
Please help me. Thanks.
Upvotes: 0
Views: 81
Reputation: 944
Unless it is just a typo in what you copy/pasted you have an input that isn't closed, which probably kills the input after it (login in this case).
<input class="loginButton" id="loginButton" type="submit" value="Go"
should be
<input class="loginButton" id="loginButton" type="submit" value="Go" />
Upvotes: 1