duanpao4522 2019-02-26 00:27
浏览 59

如何在一个页面中传递信息并在另一个页面中检索它?

Hello I'm learning php but I'm hard stuck on what the next step should be. I have a multidimensional array:

$fruits=array(
    array(
        "name"=>"The Banana", 
        "color"=> "Yellow", 
        "information"=>"bananas have lots of fiber."),
    array(
        "name"=>"The Strawberry", 
        "color"=> "Red", 
        "information"=>"strawberries have lots of vitamin."),
;

I'm able to show the array with my for each function

function show_fruits($fruits){    
    foreach($fruits as $fruit) 
        echo $fruit[name]."<br>".$fruit[color];
}

But now I want to pass the information into a new single page where it also shows the "information" key depending on the selection.

I was trying to use $_GET and embed the URL into my function but I was only getting "the" in the url result.

If anyone have better idea or how to proceed I would greatly appreciated!

  • 写回答

2条回答 默认 最新

  • duanfu6160 2019-02-26 00:35
    关注

    You can store it in the $_SESSION global variable

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题