如何将输入到表单中的值重定向到可以检索该变量的php页面?

如何将输入到表单中的值重定向到可以检索该变量的php页面?,php,forms,Php,Forms,我有两个部件需要连接在一起 1) 收集网站url的简单HTML表单 2) 接收从表单输入的url的PHP脚本 我已经完成了PHP脚本,但只有在PHP脚本中硬编码url值时,它才能工作。我不明白如何将url值从html表单传输到PHP脚本 表格如下: <form id="dm" class="api" method="post" action="apigenerate.php"> <input id="element_1" name="element_1" class="e

我有两个部件需要连接在一起

1) 收集网站url的简单HTML表单

2) 接收从表单输入的url的PHP脚本

我已经完成了PHP脚本,但只有在PHP脚本中硬编码url值时,它才能工作。我不明白如何将url值从html表单传输到PHP脚本

表格如下:

<form id="dm" class="api"  method="post" action="apigenerate.php">
  <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/> 
  <input type="hidden" name="form_id" value="710370" />
  <input class="button_text" type="submit" name="submit" value="Submit" />
</form> 

这是API脚本,第6行是需要输入值的地方

<?php
$data = '
{   
"site_data":
{                       
" the form input goes here "
}
}
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.servername.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "username:Ypassword");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                             

查看您迄今为止所做的工作可能会有所帮助,但传统上您会这样做:

HTML


PHP



您可以编写API,但不能编写html表单\php处理程序?(表格,输入,提交,$\u发布\$\u获取…)你很好。。。我收到了示例代码,我只知道一些基本的php。谢谢,我没想到问一个简单的问题对其他人来说是如此的侮辱
<form action=myscript.php method=POST>
   <input type=text name=websiteUrl />
</form>
<?php
   $url = $_POST['websiteUrl'];
?>