[英]Variable PHP in a String with HTML Tags
I need pass this string to the HTML. 我需要将此字符串传递给HTML。 I have this now:
我现在有这个:
if(empty($_SESSION['usuario'])){
$html = '<form class="form-inline formulario5" action="datos.php" enctype="multipart/form-data" method="post">
<div class="form-group">
<label for="user">Usuario</label>
<input type="text" class="form-control" id="user" placeholder="" name="user"/>
</div>
<div class="form-group">
<label for="password">Contraseña</label>
<input type="password" class="form-control" id="password" placeholder="" name="password"/>
</div>
<button type="submit" class="btn btn-success">Log-In</button>
</form>';
}else{
$html = '<h3><?$_SESSION['usuario']?></h3>';
}
To this HTML: 到此HTML:
<div class="container">
<h1>Producto</h1>
<h2 class="absorver">App</h2>
<?echo $html?>
<hr />
</div>
The problem is that i can´t pass the $html with the $_SESSION. 问题是我无法通过$ _SESSION传递$ html。
try this: 尝试这个:
if(empty($_SESSION['usuario'])){
$html = '<form class="form-inline formulario5" action="datos.php" enctype="multipart/form-data" method="post">
<div class="form-group">
<label for="user">Usuario</label>
<input type="text" class="form-control" id="user" placeholder="" name="user"/>
</div>
<div class="form-group">
<label for="password">Contraseña</label>
<input type="password" class="form-control" id="password" placeholder="" name="password"/>
</div>
<button type="submit" class="btn btn-success">Log-In</button>
</form>';
}
else
{
$sess = $_SESSION['usuario'];
$html = "<h3>". $sess . "</h3>";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.