dongyan5141 2011-12-15 02:06
浏览 13
已采纳

HTML形成多个号召性用语

I want to make a call to some php file before that I'm trying to use forms to store user data into database through a php file, but the problem is form can't call two actions in a single form.

My submit should be redirecting me to do storing database and display those contents with php file?

Can any one having idea what i'm doing mistake or alternative task to do for it ?

  • 写回答

2条回答 默认 最新

  • douxi9245 2011-12-15 04:00
    关注

    If you really want to separate the pages for form, database_actions and display:

    In your php file containing the form:

    <form action="database_actions.php"><!-- means form posts to action.php //-->
    

    In database_actions.php :

    # Place code to insert into database and make sure 
    # no echo or print_f/r commands are issued
    # and no spaces or line breaks at the top before `<?php`
    # Then place this at the end of
    header("Location: http://host/display.php");
    

    In display.php, you can show whatever output. If you have values to pass, then you may force the movement through sessions.

    This kind of approach used to be fine in the old days, MAYBE, but now there are many ways to properly perform the actions you have in mind.. One of them is the Model-View-Controller design pattern.

    Of course, you'd be better off using an MVC design pattern.. Here's a sample link:

    http://www.tonymarston.net/php-mysql/model-view-controller.html

    You can perform a search in google too.. Surely you'll find loads more on MVC patterns..

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

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备