目前登录的用户必须手动输入他们的姓名才能发表评论或发帖,但我想在自动插入的 html 表单的字段名称中获取用户名。同时用户也不能更改名称字段。
我如何在用户名字段中创建这样的会话,我试过但代码不起作用..
//create the form to submit comments
//you can add more fields, but make sure you add them to the db table and the page, submitcomment.php
echo "
<a name=\"post\">
<div id=\"submitcomment\" class=\"submitcomment\">
<form name=\"submitcomment\" method=\"post\" action=\"submitcomment.php\" onSubmit=\" return form_Validator(this)\">
<table width=\"100%\">
<tr>
<th colspan=\"2\"><h4><span>Leave your comment:</span></h4></th>
</tr>
<th scope=\"row\"><p class=\"req\">Name:</p></th> <td><input type= class=\"form\" tabindex=\"1\" id=\"name\" name=\"name\" /></td> </tr>
<tr>
<th scope=\"row\"><p class=\"opt\">Email:</p></th>
<td><input class=\"form\" tabindex=\"2\" id=\"email\" name=\"email\" /></td>
</tr>
<tr>
<th scope=\"row\"><p class=\"opt\">URL:</p></th>
<td><input class=\"form\" tabindex=\"3\" id=\"url\" name=\"url\" /></td>
</tr>
<tr valign=\"top\">
<th scope=\"row\"><p class=\"req\">Comments:</p><br /></th>
<td><textarea class=\"formtext\" tabindex=\"4\" id=\"message\" name=\"message\" rows=\"10\" cols=\"50\"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type=\"submit\" name=\"post\" class=\"submit\" value=\"Submit Comment\" /><br />
<p>Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted. </p>
<p>In Beta Phase</p>
</td>
</tr>
</table>
<input type=\"hidden\" name=\"tuturl\" value=\"$tuturl\" />
<input type=\"hidden\" name=\"tutid2\" value=\"$tutid2\" />
</form>
</div>
";
}
?>