调用存储的会话值 [英] Recalling stored session values
问题描述
我正在使用它:
[PHP] //初始化一个会话。
session_start();
//欢迎用户(按名称登录)。
echo''< h1>欢迎'';
if(isset ($ _SESSION [''first_name''])){
echo",{$ _SESSION [''first_name'']}!" ;;
}
echo''< / h1>'';
?> [/ PHP]
什么时候有人注册他们也提交:
- last_name
- 电子邮件
- company_name
在数据库表包含人员的注册信息,他们也被分配了user_id。
注册并登录后,他们将被带到表格中。我想用我已经拥有其信息的字段填充表单的一部分:
- first_name
- last_name
- 电子邮件
- company_name
我还可以使用隐藏字段将其user_id包含在表单中吗?这样,如果他们需要编辑他们在这里输入的信息,就可以使用它。
我不知道该怎么做。我知道我可以查询数据库并以这种方式提取信息并填充这些表单字段,但你也不能使用会话吗?
有人可能想要访问形成好几次,我不希望他们一次又一次地重新输入相同的信息。
谢谢。
_SESSION [''first_name''])){
echo",{
_SESSION [''first_name'']}!" ;;
}
echo''< / h1>'';
?> [/ PHP]
当有人注册时,他们也会提交:
- last_name
- company_name
在包含此人注册信息的数据库表中,还为他们分配了user_id。
注册并登录后,他们将被带到表格中。我想用我已经拥有其信息的字段填充表单的一部分:
- first_name
- last_name
- 电子邮件
- company_name
我还可以使用隐藏字段将其user_id包含在表单中吗?这样,如果他们需要编辑他们在这里输入的信息,就可以使用它。
我不知道该怎么做。我知道我可以查询数据库并以这种方式提取信息并填充这些表单字段,但你也不能使用会话吗?
有人可能想要访问多次形成,我不希望他们不得不一次又一次地重新输入相同的信息。
谢谢。
我意识到我上面写的内容令人困惑,所以我会尽量让它更容易理解。
我的网站允许本地职位发布。在某人发布广告之前,他们必须注册并登录。如果登录成功,则会将其定向到可以输入其工作信息的表单。以下字段位于用户数据库中:
user_id
电子邮件
通过
first_name
last_name
company_name
活跃
registration_date
作业数据库有:
user_id
display_name(单选按钮选项 - *见下文,本地公司或国家公司)
job_position
job_status(全职,兼职,全职或兼职,临时)
city
content
* [PHP] value ="<?php echo" {
I''m using this:
[PHP]// Initialize a session.
session_start();
// Welcome the user (by name if they are logged in).
echo ''<h1>Welcome'';
if (isset($_SESSION[''first_name''])) {
echo ", {$_SESSION[''first_name'']}!";
}
echo ''</h1>'';
?>[/PHP]
When someone registers they also submit:
- last_name
- email
- company_name
In the database table that contains the person''s registration information they are also assigned a user_id.
Once registered and logged in they are taken to a form. I would like to populate the portion of the form with the fields that I already have their information for:
- first_name
- last_name
- email
- company_name
Can I also include their user_id into the form using a hidden field? This way it can be used if they ever need to edit the information they''re entering here.
I don''t know how to do this. I know I can query the database and pull the information out that way and populate these form fields, but can''t you also do it using sessions?
Someone may want to access the form several times and I wouldn''t want them to have to re-enter in the same information again and again.
Thanks.
_SESSION[''first_name''])) {
echo ", {
_SESSION[''first_name'']}!";
}
echo ''</h1>'';
?>[/PHP]
When someone registers they also submit:
- last_name
- company_name
In the database table that contains the person''s registration information they are also assigned a user_id.
Once registered and logged in they are taken to a form. I would like to populate the portion of the form with the fields that I already have their information for:
- first_name
- last_name
- company_name
Can I also include their user_id into the form using a hidden field? This way it can be used if they ever need to edit the information they''re entering here.
I don''t know how to do this. I know I can query the database and pull the information out that way and populate these form fields, but can''t you also do it using sessions?
Someone may want to access the form several times and I wouldn''t want them to have to re-enter in the same information again and again.
Thanks.
I realize what I wrote above is confusing, so I''ll try to make it more understandable.
My website allows for local job posting. Before someone can post an ad they have to register and log in. If the login is successful they are directed to a form where they can enter in their job information. The fields below are in the users database:
user_id
pass
first_name
last_name
company_name
active
registration_date
The jobs database has:
user_id
display_name (radio button options are - *see below, Local Company or National Company)
job_position
job_status (Full-time, Part-time, Full or Part-time, Temporary)
city
content
*[PHP]value="<?php echo "{
这篇关于调用存储的会话值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!