donglusou3335 2016-06-06 03:39
浏览 106

从另一个页面抓取表单数据并以html格式显示

I have a meal type page (breakfast.php) that a user can select a breakfast package. Once the package selection is confirmed I would like to display that selection in the homepage.php. If I use a input = 'text' and grab the form data it works great but for some reason it will not select the content of my h4 element. Is there a way to grab the selection even if there is say 4 or 5 packages?

This is my code:

breakfast.php

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

<div class= "breakfast">




<u><h2>The Share Collection</h2></u>
</br>
<img src= "\images\Breakfast\breakfast1.jpg" class="funky">
</br>
</br>
<dl>
  <dd>Mini jar of housemade granola: vanilla yoghurt, fresh fruit (v) (6)</dd>
  <dd>Goat cheese, cherry tomato &amp; basil, mushroom tart (v) (8)</dd>
  <dd>Mini slider jamon serrano, fig jam, rocket, brie &amp; black pepper (8)</dd>
  <dd>Chef's mini sweet muffin (v) (8)</dd>
  <dd>Bowl of strawberries &amp; grapes (v) (1)</dd>
</dl>

</br>
<input type='button' value='Select This Package' id='button3' onclick="changemyButton()">

<hr>

<section> 
<h1 id="logo">Total Ordered</h1></section>
<hr>
</br>

<h4 id ="selection" name="foodchoice">   </h4>
<br>
<br>
<br>
<br>
<input type="submit" id="button4" value="Submit Your Selection" name="submit">

</center>
</form>

homepage.php

<p> You have selected <?php echo $_POST["foodchoice"];?><br> as your order!

I am new to php and would like the best way to perform this. Thanks.

  • 写回答

3条回答 默认 最新

  • douqie1816 2016-06-06 04:05
    关注

    You should probably use a different html tag rather than a h4 tag. h4 is a header tag it does not send form data unless you use ajax. For what you're doing you could probably use the select and option tags. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select

    评论

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本