I'm working on a PHP code that checks the status of a server. The code works perfectly when it's used like this:
<?php
$SERVER_IP = "217.198.136.31";
$SERVER_PORT = "25565";
$QUERY_PORT = "25565";
?>
However, instead of manually assigning the values for the php variables I need to get them from two HTML input elements. I've tried the following code but it doesn't work:
<input id="checkip" name="checkip" value="217.198.136.31">
<input id="checkport" name="checkport" value="25565">
<?php
$SERVER_IP = $_POST['checkip'];
$SERVER_PORT = $_POST['checkport'];
$QUERY_PORT = $_POST['checkport'];
?>
I can't figure out why it isn't working, doesn't the $_POST get the exact value from the HTML elements and put them in the PHP variables? What should I do to get the same result for the last code?