简体   繁体   中英

how to embed html and php

how can we integrate html and php in the given code.

<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>
<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

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. Notice that the value of the input is PHP while the rest of the code is HTML

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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