Hi folks :) I'm hoping someone here can help me. The (World of Warcraft) guild I am in uses a very simple DKP system for looting. I would like to get my hands on a block that my users can input a whole number, have the code subtract 20% from that number, and display the result.
Should be pretty simple for my members to do for themselves but evidently some of them aren't familiar with simple math :-\
Thanks in advance.
Goes into a php block.
global $settings, $scripturl;
$number = '';
echo '<div style="text-align:center">';
if (isset($_POST['get_answer']))
{
if ($_POST['number'] <> '')
$number= $_POST['number'];
echo '<br />Your number was ' , $number , '<br />';
echo '<br />The answer is ';
$answer = $number x .8;
echo $answer;
echo '</div><br /><hr /><br />';
}
$str = getenv("QUERY_STRING");
if ($str)
$action = 'index.php?'.$str;
else
$action = 'index.php';
echo '<div style="text-align:center">Enter your number';
echo '<form action="',$action,'" method="post">';
echo '<input type="hidden" name="get_answer" value="1">';
echo '<input type="text" name="number" value="">';
echo '<input type="submit" value="Tell me!">';
echo '</form></div>';
echo '</div>';
Holy Smokes that was fast! Thank you!
It was easy. I have a block on my site that takes input and prints out an answer. It was just a matter of taking out a little code and adding a little bit back in.
:(
QuoteParse error: syntax error, unexpected T_STRING in /home7/*******/public_html/******/home/Sources/Load.php(1739) : eval()'d code(48) : eval()'d code on line 11
If this is a pain, I'll just send them all calculators. lol. I do appreciate your time :)
Oy vey!
I can't believe I did that! I knew better than that when I first learned programming 30 years ago!
Try this.
global $settings, $scripturl;
$number = '';
echo '<div style="text-align:center">';
if (isset($_POST['get_answer']))
{
if ($_POST['number'] <> '')
$number= $_POST['number'];
echo '<br />Your number was ' , $number , '<br />';
echo '<br />The answer is ';
$answer = $number * .8;
echo $answer;
echo '</div><br /><hr /><br />';
}
$str = getenv("QUERY_STRING");
if ($str)
$action = 'index.php?'.$str;
else
$action = 'index.php';
echo '<div style="text-align:center">Enter your number';
echo '<form action="',$action,'" method="post">';
echo '<input type="hidden" name="get_answer" value="1">';
echo '<input type="text" name="number" value="">';
echo '<input type="submit" value="Tell me!">';
echo '</form></div>';
echo '</div>';
You are SO my hero! Thank you!
:) You're welcome.
Amazing Deni :up: :)
Nice one JP, very speedy too :)
Nice JP.... great work