doubinei1457 2017-03-21 06:02
浏览 144

从$ _POST获取数据并在php中显示特定数据

This may have been asked before but i have not been able to find it.

I have created a dropdown list in a form to show a selection from a database. I am then sending that information via $_POST to another page. But i am only getting the one result (eg plantID).

$result = mysqli_query($mysqli,$sql)or die(mysqli_error());

//********************* Botannical name drop down box

echo "<form name='selection' id='selection' action='profile.php' method='post'>";

echo "<select name='flower'>";

while($row = mysqli_fetch_array($result)) {
    $plantid = $row['FlowerID'];
    $plantname = $row['Botannical_Name'];
    $plantcommon = $row['Common_Name'];
    $plantheight = $row['Height'];
    $plantav = $row['AV'];
    $plantcolours = $row['Colours'];
    $plantflowering = $row['Flower_Time'];
    $plantspecial = $row['Special_Conditions'];
    $plantfrost = $row['Frost_Hardy'];
    $plantaspect = $row['Aspect'];
    $plantspeed = $row['Growth_Speed'];

    echo "<option value=".$plantid.">".$plantname." -> AKA -> ".$plantcommon."</option>";
echo "</select>";
echo "<br />";

//********************* End of form
echo "<input type='submit' name='submit' value='Submit'/>";
echo "</form>";

Is there any way i can send all the data via post or can i somehow get the required PlantID from the database and show all the information for that record in a table on the second page. Hope this makes sense to someone out there :D

  • 写回答

1条回答 默认 最新

  • dongsi8812 2017-03-21 06:19

    Although technically you can, it is not advised nor used anywhere.

    Just send an id like you do right now and then select all the data with another query based on this id.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 关于IMageEnView 图标定位问题
  • ¥20 求解答(matlab)
  • ¥30 ffmpeg库使用过程中遇到的问题
  • ¥15 pyqt5 中python如何通过Qtwebchannel主动发消息给web前端
  • ¥15 关于HTML中title获取xml内容的问题
  • ¥15 fanuc机器人PRIO083数字信号未复原错误,如何解决?
  • ¥20 如何为现有电路板增加远程控制功能
  • ¥15 UE5打包失败,求解决
  • ¥15 请问STM32G431的CANOPEN协议函数怎么写
  • ¥15 graphpad prism 三因素重复测定报错