简体   繁体   English

如何嵌入html和php

[英]how to embed html and php

how can we integrate html and php in the given code.我们如何在给定的代码中集成 html 和 php。

<form action="login.php" method="post" >
<tr>
<td><span class="xxxx">User Name</span></td>
<td><span class="xxxx"><input type="text" name="username" id="username"             size="20" value="default value"></span></td>
</tr>
<tr>
    <td><span class="xxxx">Password</span></td>
    <td><span class="xxxx"><input type="password" name="password"     id="password" size="20"></span></td>
</tr>
<tr>
......
</form>

You have clarify us better, without any given info we cannot give our best response.你已经更好地澄清了我们,没有任何给定的信息,我们无法给出最好的回应。

But IF you are trying to embed some content of php inside the html the foundation is like that:但是,如果您试图在 html 中嵌入一些 php 内容,则基础是这样的:

<html>
<head></head>
<body>
<ul> 
<?php for($i=1;$i<=5;$i++){ ?>
<li>Menu Item <?php echo $i; ?></li> 
<?php } ?>
</ul> 
</body>
</html>

Not sure what you are looking for here seeing how no question is asked.不知道你在这里寻找什么,看看没有问题。 If you are looking to turn your HTML code into PHP如果您想将 HTML 代码转换为 PHP

echo "<form action=login.php method=post >";
echo "<tr>";
echo "<td><span class=xxxx>User Name</span></td>";
echo "<td><span class=xxxx><input type=text name=username id=username size=20 value=default value></span></td>";
echo "</tr>";
echo "<tr>";
echo "<td><span class=xxxx>Password</span></td>";
echo "<td><span class=xxxx><input type=password name=password     id=passwor" size=20></span></td>";
echo "</tr>";
echo "<tr>";

echo "</form>";

If you are looking to just insert some sort of PHP into your HTML.如果您只想在 HTML 中插入某种 PHP。 Notice that the value of the input is PHP while the rest of the code is HTML请注意,输入的值为 PHP,其余代码为 HTML

<td><span class="xxxx"><input type="text" name="username" id="username" size="20" value="<?php echo (your value) ?>" /></td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM