doumeng1143 2014-05-01 13:59
浏览 25

PHP变量设置div <p>文本

I'm sorry if this has been asked before, I've searched around SO and nothing I've come across seems to help me here.

I have a HTML page with a form which passes values to an external PHP page.

      <form method="post" action="getContent.php">

            <input type="hidden" name="fromTest" id="fromTest"/>
            <input type="hidden" name="untilTest" id="untilTest"/>
            <input type="hidden" name="latTest" id="latTest"/>
            <input type="hidden" name="longTest" id="longTest"/>
            <input type="hidden" name="search1" id="search1"/>
            <input type="hidden" name="search2" id="search2"/>


       <input type="submit" class="sendAll" value="Gather News!">
      </form>

These values are then set in the PHP to variables in SESSION

  $_SESSION['post-data'] = $_POST;
  $search1 = $_SESSION['post-data']["search1"];
  $search2 = $_SESSION['post-data']["search2"];

  $until = $_SESSION['post-data']["untilTest"];
  $since = $_SESSION['post-data']["from"];
  $lat = $_SESSION['post-data']["latTest"];
  $long = $_SESSION['post-data']["longTest"];

This all works great and for the function it was made, everything is working perfectly.

I've got a header in my HTML of which I want the text inside of the div to be the value of $search1.

The feed1MainHeader div is completely in the HTML page and has no current links to PHP.

  <div id="feed1MainHeader">
  <p>test<p>
  </div>

after the external php page is called and goes back to my html page, I need the header

value to = my first search term.

Any idea how I can do this easily?

  • 写回答

1条回答 默认 最新

  • drfif48428 2014-05-01 14:09
    关注

    You can output data stored in session with

    echo $_SESSION['post-data']['search1']
    

    where you need to first search string to appear.

    评论

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢