doukangbin9698 2014-07-14 14:32
浏览 14
已采纳

PHP将表单信息发送到2个不同的文件

I'm having a bit of a problem with a form. I need to send its information to 2 different pages for two different uses. One of the pages will show what was inserted in the form and the other one will use the form's title as a link to the other page.

The code I'm using is below. Right now, it only takes the form info and shows it in the View.php page.

I'm pretty sure I'll have to use some PHP in here, but I'm out of ideas.

<html>
<head>
    <title>!!!!Protótipo de Formulario de Noticia!!!!</title>

    <style>
        textarea{
            resize:none;
        }
        </style>
</head>
<body>
    <form method="post" action="View.php">
        <p>Titulo: <input type="text" name="Titulo" required/></p>
        <p>Digite o texto da noticia abaixo:</p>
        <textarea rows="10" cols="50" name="Noticia" required></textarea>
        <br>
        <input type="submit" value="Publicar" onsubmit="location.href='View.php;'" />
    </form>
</body>

</html>
  • 写回答

1条回答 默认 最新

  • dongmi5177 2014-07-14 14:38
    关注

    you do not need

    onsubmit="location.href='View.php;'
    

    The simplest approach is to submit to one page, which acts as a controller. It can process the data, and selects a template for displaying the next page.

    If needed, you can also pass data across pages with either a session, or http query params (url?id=1234)

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

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作