html代码中div标记的错误消息

时间:2014-05-01 07:57:45

标签: javascript php jquery html css

我有这样的代码:

...
            header("Location: private.php");
            die("Redirecting to: private.php");
        }
        else
        {
            print("Login Failed."); >>I WANT MOVE THIS IN DIV TAG<<   
....

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
</head>
<body>
    <div id="container">
        <div id="header-main">Main Menu</div>
        <div id="header"></div>
        <div id="content">
            <div class="table">
                <div class="tr">
                    <div id="member" class="td" align="center">
                        <span class="member">Data</span>
                    </div>
                    <div class="vr">&nbsp;</div>
                    <div id="login" class="td">
                    <div class="login-error"> **>>> HERE ERROR MESSAGE <<<** </div>
                    <div class="login-title">LogIn</div>
                        <form action="login.php" method="post">
                           <input type="text" name="username" value="<?php echo $submitted_username; ?>" placeholder="Username" autofocus/>
                            <br /><br />
                            <input type="password" name="password" value="" placeholder="Password"/>
                            <br /><br />
                            <input type="submit" value="Login" />
                                                    </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

$errorMessage = null;

else{  ...
            $errorMessage = "Login Failed.";
         ....


in html >>>
<?php if(!empty($errorMessage)) ?>
<div class="login-error"><?php echo $errorMessage;?></div>