3 回答

TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超3個(gè)贊
我認(rèn)為你需要這樣做
<form action='addnewthread.php' method='post'>
<input type='text' name='thread-title' id='thread-title' placeholder='Type title here' class='user-input'
<?php
if(isset($_SESSION['threadTitle']) && !empty($_SESSION['threadTitle']))
{
echo "value='{$_SESSION['threadTitle']}'";
}
?>
>
<textarea id='threadCont' name='threadCont'>
<?php
if(isset($_SESSION['threadCont']) && !empty($_SESSION['threadCont']))
{
echo $_SESSION['threadCont'];
}
?>
</textarea>
<button id='submit' type='submit' name='submit'value='success'>Submit</button>
</form>

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊
只需回顯變量,只需注意"and'因?yàn)樽址B接。
對(duì)于輸入:
<input type='text' name='thread-title' id='thread-title' placeholder='Type title here' class='user-input'
<?php
if(isset($_SESSION['threadTitle'])&!empty($_SESSION['threadTitle'])
{
echo "value='".$_SESSION['threadTitle']."'";
}
?>
/>
對(duì)于文本區(qū)域:
<textarea id='threadCont' name='threadCont'>
<?php
if(isset($_SESSION['threadCont'])&!empty($_SESSION['threadCont'])
{
echo $_SESSION['threadTitle'];
}
?>
</textarea>

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
我檢查了您的代碼,發(fā)現(xiàn)您忘記添加圓括號(hào):
<form action='addnewthread.php' method='post'>
<input type='text' name='thread-title' id='thread-title' placeholder='Type title here' class='user-input'
<?php
if(isset($_SESSION['threadTitle'])&&!empty($_SESSION['threadTitle']) <--here
{
echo "value='{$_SESSION['threadTitle']}'";
}
?>
>
<textarea id='threadCont' name='threadCont'>
<?php
if(isset($_SESSION['threadCont'])&&!empty($_SESSION['threadCont']) <--and here
{
echo $_SESSION['threadCont'];
}
?>
</textarea>
<button id='submit' type='submit' name='submit'value='success'>Submit</button>
</form>
您還需要替換&為&&.
- 3 回答
- 0 關(guān)注
- 209 瀏覽
添加回答
舉報(bào)