Home > Backend Development > PHP Tutorial > php项目 注册登录模块

php项目 注册登录模块

WBOY
Release: 2016-06-23 14:11:57
Original
1935 people have browsed it

PHP

注册页面刚注册了个用户名,注册成功后重定向到登录页面,怎样把那个用户名显示到登陆框

回复讨论(解决方案)

用session或在表单中带过去。

用session或在表单中带过去。
用session的话,在html页面中该怎样接收呢?html页面和php程序是分离的。

<input type="text" name="username" value="<?php echo $_COOKIE['username']?>">
Copy after login
Copy after login

<input type="text" name="username" value="<?php echo $_COOKIE['username']?>">
Copy after login
Copy after login

已经解决了,也算是这样做的,谢谢!
$name = $_SESSION["userinfo"]["loginname"];unset($_SESSION["userinfo"]["loginname"]);echo "<input name=loginname type=hidden id=loginname value=$name>";
Copy after login

function init(){    var loginname = document.getElementById('loginname').value;    if(loginname != ""){	document.getElementById("username").value = loginname;}}window.onload = init;
Copy after login

分离的 如果是smarty 做一个assign

如果通过表单:直接post过去,接收的话。<?php echo $_POST['username'];?>如果通过js跳转,那你通过get接收。<?php echo $_GET['username'];?>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template