我有login.html的模板。有一行:<h5>&copy; Your Company</h5>。我想从MySQL数据库中提取公司名称。我有compnayname.php文件,可从db获得公司名称。如何将其实现为以下代码?谢谢。

<div id="container">
    <hgroup id="login-title" class="large-margin-bottom">
        <h1 class="login-title-image">Company</h1>
        <h5>&copy; Your Company</h5>
    </hgroup>

    <form method="post" action="" id="form-login">
        <ul class="inputs black-input large">
            <!-- The autocomplete="off" attributes is the only way to prevent webkit browsers from filling the inputs with yellow -->
            <li><span class="icon-user mid-margin-right"></span><input type="text" name="login" id="login" value="" class="input-unstyled" placeholder="Login" autocomplete="off"></li>
            <li><span class="icon-lock mid-margin-right"></span><input type="password" name="pass" id="pass" value="" class="input-unstyled" placeholder="Password" autocomplete="off"></li>
        </ul>

        <button type="submit" class="button glossy full-width huge">Login</button>
    </form>
</div>

最佳答案

login.php

<div id="container">

    <hgroup id="login-title" class="large-margin-bottom">
        <h1 class="login-title-image">Company</h1>
        <h5>&copy; <?php include("companyname.php");?></h5>


    </hgroup>

    <form method="post" action="" id="form-login">
        <ul class="inputs black-input large">
            <!-- The autocomplete="off" attributes is the only way to prevent webkit browsers from filling the inputs with yellow -->
            <li><span class="icon-user mid-margin-right"></span><input type="text" name="login" id="login" value="" class="input-unstyled" placeholder="Login" autocomplete="off"></li>
            <li><span class="icon-lock mid-margin-right"></span><input type="password" name="pass" id="pass" value="" class="input-unstyled" placeholder="Password" autocomplete="off"></li>
        </ul>

        <button type="submit" class="button glossy full-width huge">Login</button>
    </form>

</div>


companyname.php

get company_name here and echo it.

echo $company_name;

关于php - html中来自mysql数据库的数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21625911/

10-11 01:40
查看更多