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).

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