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 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器