好吧,故事是我在做一个服务台
并且我当然登录了,我希望我的登录信息(例如我的名字)自动出现在文本框中..并使文本框呃,“不可更改”
我可以获取“当前登录帐户”资料...
我怎么做?http://postimg.org/image/ts98d7stp/full/
这是我的helpdesk.php
<?php
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Your name:<br>
<input name="name" type="text" value="" size="30"/><br>
Your email:<br>
<input name="email" type="text" value="" size="30"/><br>
Your message:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Send email"/>
</form>
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form";
mail("[email protected]", $subject, $message, $from);
echo "Email sent!";
}
}
?>
/ *我要在此测试的部分回显我当前登录的数据,现在我需要知道如何将其放在文本框中并禁用文本编辑/输入* /
<table cellspacing="0" width="100%" id="example" >
<thead>
<tr>
<th>First Name</th> <!-- 4 -->
<th>Last Name</th> <!-- 4 -->
<th>Middle Name</th> <!-- 4 -->
<th>Email</th> <!-- 4 -->
<th>Address</th> <!-- 4 -->
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $row['userfirstName']; ?></td> <!-- 4 -->
<td><?php echo $row['userlastName']; ?></td> <!-- 4 -->
<td><?php echo $row['usermiddleName']; ?></td> <!-- 4 -->
<td><?php echo $row['userEmail']; ?></td> <!-- 5 -->
<td><?php echo $row['userAddress']; ?></td> <!-- 5 -->
您应该从登录用户创建$ _SESSION变量,并将其放入文本框中,如下所示:
<input name="name" type="text" value="<?php echo $_SESSION['name']; ?>"size="30"/>
希望对您有所帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句