I have an HTML form that I need to submit to a php file that adds it to a database, as well as to an existing php file that adds it to an online CSV file.
我有一个HTML表单,我需要提交到一个php文件,将其添加到数据库,以及现有的php文件,将其添加到在线CSV文件。
Any ideas?
3 个解决方案
#1
4
Create a new php file, like this:
创建一个新的php文件,如下所示:
<?php
include('form_handler_1.php');
include('form_handler_2.php');
?>
#2
1
Use the $_POST or $_GET array to call the other file.
使用$ _POST或$ _GET数组来调用另一个文件。
For example after your mysql take the $_POST and submit them with $_GET to the next file.
例如,在您的mysql获取$ _POST并将$ _GET提交到下一个文件之后。
file 1:
$name = $_POST['name'];
$address = $_POST['address'];
## put here your mysql query and connect
## end query
##submit the values as variables to the other script
$url = "http://www.mysite.com/seconfile.php?name=".$name."&address=".$address;
file_get_contents ($url);
second file:
$name = $_GET['name'];
Curl would also fit or fopen or file.
卷曲也适合或fopen或文件。
You can do that endlessly and shorten the coding with using a foreach loop through the array creating the urls.
您可以无限制地执行此操作并使用foreach循环通过创建URL的数组来缩短编码。
coded but not tested
编码但未测试
#3
0
You could send it to your database php file, and then use curl to send the request to the second php file.
您可以将它发送到您的数据库php文件,然后使用curl将请求发送到第二个php文件。
See this link for instructions on how to use curl :)
有关如何使用curl的说明,请参阅此链接:)
#1
4
Create a new php file, like this:
创建一个新的php文件,如下所示:
<?php
include('form_handler_1.php');
include('form_handler_2.php');
?>
#2
1
Use the $_POST or $_GET array to call the other file.
使用$ _POST或$ _GET数组来调用另一个文件。
For example after your mysql take the $_POST and submit them with $_GET to the next file.
例如,在您的mysql获取$ _POST并将$ _GET提交到下一个文件之后。
file 1:
$name = $_POST['name'];
$address = $_POST['address'];
## put here your mysql query and connect
## end query
##submit the values as variables to the other script
$url = "http://www.mysite.com/seconfile.php?name=".$name."&address=".$address;
file_get_contents ($url);
second file:
$name = $_GET['name'];
Curl would also fit or fopen or file.
卷曲也适合或fopen或文件。
You can do that endlessly and shorten the coding with using a foreach loop through the array creating the urls.
您可以无限制地执行此操作并使用foreach循环通过创建URL的数组来缩短编码。
coded but not tested
编码但未测试
#3
0
You could send it to your database php file, and then use curl to send the request to the second php file.
您可以将它发送到您的数据库php文件,然后使用curl将请求发送到第二个php文件。
See this link for instructions on how to use curl :)
有关如何使用curl的说明,请参阅此链接:)