drqja5919276 2017-05-27 12:39
浏览 18
已采纳

为什么这个表单数据不会发送到下一页?

I am not experienced with PHP in the slightest, but this form should send information from the page you select it on to another page:

<form name="form1" method="post" action="nextpage.php">
   <select name="form">
     <option value="bike">BMX 3000</option> 
   </select>
   <input type="submit">
</form>

The next page has this code:

<html>
    <body>
       <center>You selected <?php echo $_POST['form']; ?></center>
    </body>
</html>

Would love some help!

  • 写回答

2条回答 默认 最新

  • ds753947 2017-05-27 16:09
    关注

    page.html,

    <form name="form1" method="post" action="nextpage.php">
        <select name="form">
            <option value="Bike">BMX 3000</option> 
        </select>
        <input type="submit">
    </form>
    

    nextpage.php,

    <body>
        <center>You selected <?php echo htmlspecialchars($_POST[form]); ?></center>
    </body>
    

    Output,

    You selected Bike

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部