简体   繁体   English

将表单结果发送到另一个页面php mysql

[英]Send form results to another page php mysql

Hello I have a form working properly using 你好,我有一个表格正常使用

php echo $_SERVER['PHP_SELF']

The results are shown on same page as form. 结果显示在同一页面上。

I need to be able to send the form data and results to another page (eg results.php ) when the user submits the form. 当用户提交表单时,我需要能够将表​​单数据和结果发送到另一个页面(例如results.php )。

How is this achieved? 这是如何实现的?

Just point the form action to results.php 只需将表单操作指向results.php即可

<form action="results.php">
 <!--Inputs-->
</form>

Or if you need to do a redirection store $_GET at $_SESSION['parameters'] . 或者,如果您需要在$ _SESSION ['parameters']执行重定向存储$ _GET

Here are some attributes of form tag <form> you need to set them.. 以下是您需要设置表单标签<form>一些属性..

<form action="controller.php" method="post">
 <!--form elements-->
<input type="submit" name="submit" value="Submit Form" />
</form>

Here when ever the submit button clicked, it will submit the form to its action ie controller.php by post method (ie form elements' value won't display in query string). 这里当点击提交按钮时,它会通过post方法将表单提交给它的动作,即controller.php (即表单元素的值不会显示在查询字符串中)。

Later you can access their value on controller.php by $_REQUEST['element_name'] or $_POST['element_name'] or $_GET['element_name'] according to the form method type. 之后,您可以根据表单方法类型,通过$_REQUEST['element_name']$_POST['element_name']$_GET['element_name']controller.php上访问它们的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM