doujiang1939 2011-02-03 18:36
浏览 18

PHP会话支持

I have never worked with sessions before so just need a bit of guidance. Some data from a form needs to be held whilst someone logs in. So I have got this far.

<?php
$_SESSION['tmp']['booking-form'] = array(
    'GT_title' => $SEStitle,
    'GT_actual_duration' => $SESactualduration,
    'SEScalstartdate' => $calstartdate,
    'GT_picture' => $picture,
    'GT_total_duration' => $SEStotalduration,
    'GT_total_dives' => $SEStotaldives,
    'GT_total_price' => $SEStotalprice,
    'GT_total_duration' => $SEStotalduration,
    'GT_specifications' => $SESspecifications
);
?>

Three questions.

  1. Where do I put this code as all the named fields in the array exist in a form towards the bottom of the page before the log in process begins.

  2. Is that all the code I need or do I need to put something else somewhere else.

  3. What do I do to call this session when the client has finished logging in and has been redirected to the booking area where I want this data to be called back up.

  • 写回答

2条回答 默认 最新

  • dongyi7901 2011-02-03 18:41
    关注

    Wherever you want to use the session data, call session_start() at the top of any page before any output.

    You set the $_SESSION[] wherever you have the data.

    You can get the data after login using the same $_SESSION[] array. It will be populated as soon as session_start() has been called.

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀