-6

你如何在php中添加一个html表单?我必须检查 isset 的条件,即是否设置了会话,然后才应该显示表单。由于“”,ECHO 语句不起作用

<pre>
<form action="index.php" method="post">
<br />
&nbsp;First Name:    Last Name:<br/>
<input type="text" name="firstname" placeholder ="First Name"/>  
<input type="text" name="lastname" placeholder ="Last Name"/><br />

&nbsp;Email-id:<br />
<input type="text" name="email-id" placeholder ="Your Email-id"/><br />

&nbsp;Password:<br />
<input type="password" name="password" placeholder ="Your Password"/>
<br />
&nbsp;Re-enter Password:<br />
<input type="password" name="password1" placeholder ="Re-enter Password"/>
<br /></form><pre>
4

3 回答 3

2
<?php if( isset( $_SESSION['someValue'] ) ): ?>
<form action="index.php" method="post">
    <p>Whatevs...</p>
</form>
<?php endif; ?>
于 2012-12-12T09:47:44.643 回答
0
echo "I want to echo \"quotes\""; // prints: I want to echo "quotes"
echo 'I want to echo "quotes"'; // prints: I want to echo "quotes"

选择一个,它都有效。或者:

<?php if($something == $the_same_as_this): ?>
   I want to print whatever I want, including "quotes"
<?php endif; ?>

将输出字符串(只要表达式评估为真)

于 2012-12-12T09:49:00.653 回答
0

尝试以下操作:

<?php if(your_condition_here): ?>
<form> your form here </form>
<?php endif; ?>

这样您就不必使用 echo 或 print 并使其复杂化。

于 2012-12-12T09:50:11.543 回答