简体   繁体   English

在字段中显示存储在会话中的值(使用php)

[英]Displaying the values stored in a session(using php) into a field

Here's the situation, 这是情况

I created 6 pages,each of which has some text fields.I stored the values entered in these text fields in php sessions.now after the user fills up these text fields,he will be going to a confirmation page,where he will be verifying the details and then the values are submitted. 我创建了6个页面,每个页面都有一些文本字段。我将在这些文本字段中输入的值存储在php会话中。现在,在用户填写完这些文本字段后,他将转到确认页面,在该页面中进行验证详细信息,然后提交值。

Now in this confirmation page is there a way where we could display the data entered by the user(this data is retrieved from the session) in something like a label or someother field.I donot want to use a textbox for populating this data. 现在在该确认页面中,有一种方法可以在标签或其他字段中显示用户输入的数据(此数据是从会话中检索的),我不想使用文本框来填充此数据。

Any Suggestions will be useful.Thanks in advance. 任何建议都将是有用的。

How about something simple like this 这样简单的事情怎么样

<h2>Info you entered</h2>
First Name: <?php echo $_SESSION["first_name"]; ?>
<br />
Last Name: <?php echo $_SESSION["last_name"]; ?>

I'm not sure if I exactly understand, but you can pretty much get the data directly from the session via: 我不确定我是否完全理解,但是您可以通过以下方式直接从会话中获取数据:

 $_SESSION['myvar']

within a php page you can just use this within a label, example: 在php页面中,您可以在标签中使用它,例如:

<div><?= $_SESSION['myvar'] ?></div>

where the above is just the label. 以上只是标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM