-1

这就是我的代码,所有<input>标签的问题,谁能告诉我这是集成 HTML 和 PHP 的正确方法

<div style="width:115px; padding-top:10px;float:left;" align="left">Email Address:</div>
<div style="width:300px;float:left;" align="left">

<input type="text" name="email" id="email" value="<?php echo strip_tags($_POST["email"]); ?>"     class="vpb_textAreaBoxInputs"></div><br clear="all"><br clear="all">
4

2 回答 2

2

you need to make sure that $_POST["email"] is set before use for that you can use isset() like

<?php if(isset($_POST["email"])) { echo strip_tags($_POST["email"]); }else{echo 'default' ;} ?>
于 2013-04-09T13:07:01.217 回答
0

用于显示每个默认ternary operatorinput

<input type="text" name="email" id="email" value="<?php echo isset($_POST['email'])?strip_tags($_POST['email']):''; ?>" class="vpb_textAreaBoxInputs"></div><br clear="all"><br clear="all">

同样的firstname

<input type="text" name="firstname" id="firstname" value="<?php echo isset($_POST['firstname'])?strip_tags($_POST['firstname']):''; ?>" > 
于 2013-04-09T13:04:21.027 回答