简体   繁体   中英

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
$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=". I tried few things like POST and GET method, Again i missed something.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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