Hi I have made buttons in my website, made via html forms:
form method='GET' name='sel'>
<table>
<tr><td>zipcode<td><input name='zipcode' size=8 value=""> housenumber <input name='housenumber' size=4 value="">
<tr><td><input type=submit value='Make map' OnClick="document.sel.submit(); show('bewaar')">
</table>
<hr style='margin-bottom: 1px'>
</form>
I want with the 'make map' button, that my input from the html is parsed into the rest of my code. I try to parse it with the following:
global $zipcode, $housenumber;
function get_data() {
$zipcode=$_GET['zipcode'];
$housenumber=$_GET['housenumber'];
}
Does my 'make map' button not working properly, or do I do something else wrong? Because when I echo $zipcode
after get_data function for instance, it stays empty. I'm new to php coding, so probably I don't see some issues. With these zipcode and number, I can create a geocoded image of a topographic map, which is coded after this piece of code.
Where do you call the function get_data()
?
You need to check if the submit button is pressed. But you need a name for your submit button.
You can also check if zipcode is set, like this:
if(isset($_GET['zipcode')) {
include "path/to/file/where/your/function/is";
get_data();
}
It's not really the way to go I think. But this should do the trick.