简体   繁体   English

将值传递给php变量

[英]Pass value to php variable

This post is the continuation of my previous post, i missed one point, so i started new thread. 这篇文章是我上一篇文章的延续,我错过了一点,所以我开始了新话题。 I got solution for my previous post and my final code looks like below: 我为以前的帖子找到了解决方案,最终代码如下所示:

Scrapping code not working in php 报废代码无法在php中使用

<?php
$html = file_get_contents("http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=79401:006:0812");
preg_match_all('(<li.*?>.*?</li>)', $html, $matches);
$one=$matches[0][0];
?>

<script type="text/javascript">
function Assign() {
    document.getElementById("OutputField").value = "<?=$one?>";
}
</script>

<input id="OutputField" type="text" style="width:200px"/>
<input type="button" value="Assign Value" onclick="Assign()"/>

On further i have added one more input box at the end, In that textbox, i am going to input my values in runtime, so once i clicked my button, textbox value will go to php variable and then that variable will assign after "ky=". 再进一步,我在最后添加了一个输入框,在该文本框中,我将在运行时输入值,因此,一旦单击按钮,文本框值将转到php变量,然后该变量将在“ ky =“。 I tried few things like POST and GET method, Again i missed something. 我尝试了一些诸如POST和GET方法之类的东西,再次错过了一些东西。

I am looking some thing like 我看起来像

$html = file_get_contents("http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=" + $PHPvariable);

You need to learn about handling forms and form information in PHP: 您需要了解有关在PHP中处理表单和表单信息的信息:

http://php.net/manual/en/tutorial.forms.php http://php.net/manual/zh/tutorial.forms.php

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

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