Kintaro
Well-known member
Hi,
I'm trying to understand php callback but I miss something.
I have to make a new page in xenforo with a form and then manipulate the form's data.
form example:
compute data example (same page):
now It's correct to use Xenforo Page to do something like this or is better make an add-on?
I'm trying to understand php callback but I miss something.
I have to make a new page in xenforo with a form and then manipulate the form's data.
form example:
HTML:
<form action="#" name="compute" method="post">
<input type="checkbox" name="won" /><br />
<input type="text" name="myRank" /><br />
<input type="text" name="opponentRank" /><br />
<input type="radio" name="geo" value="national" /><br />
<input type="radio" name="geo" value="regional"/><br />
<input type="radio" name="geo" value="provincial" /><br />
<input type="submit" name="compute" value="Go!" />
<a href="<?php echo $_SERVER["SCRIPT_NAME"];?>">Refresh</a>
</form>
compute data example (same page):
PHP:
if(isset($_POST['compute'])){
$points = ($_POST["won"] == "on") ? win($_POST["myRank"], $_POST["hisRank"]) : defeat($_POST["myRank"], $_POST["hisRank"]);
echo $points;
}