Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-21-2008, 05:56 PM
StakingAces StakingAces is offline
 
Join Date: Oct 2007
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default calculator

I have come up with a calculator I wish to add to one of my threads for my members to use in that thread. Here is the PHP I have come up with:
<html>
<body>
<?php
$stake = $_POST['stake'];
$cash = $_POST['cash'];
$newline = "<br/>";

$newline;$newline;
if( is_numeric($cash) && is_numeric($stake) )


{

{
$horseshare = $cash/2-$stake/2;
$stakershare = $horseshare + $stake;

echo "You need to ship: \$".$stakershare.$newline;
echo "You keep: \$".$horseshare.$newline.$newline;

}
}
else{ echo("Invalid entry - please retry"); }
?>

<a href="http://www.stakingaces.com"> Back to Index </a>
</body></html>

Can someone just steer me as to the whereabouts I should load this?

--------------- Added [DATE]1203623838[/DATE] at [TIME]1203623838[/TIME] ---------------

It's basically a formula we use there but I want it to be able to be embedded in a thread for them to use on site instead of having to pull up their own calculator and messing the formula up and us having to correct it within the thread each time.

--------------- Added [DATE]1203650350[/DATE] at [TIME]1203650350[/TIME] ---------------

I actually had someone come up with a java code for me to use but its not accepting the user code. Any ideas as to why?

<html>
<head>
<script type="text/javascript">
<!--

function calculate(task){
var f1 = document.getElementById("stake");
var f2 = document.getElementById("cash");
var f3 = document.getElementById("horseshare");
var f4 = document.getElementById("stakershare");
var f5 = document.getElementById("siteshare");


if(!isNumber(f1.value) || !isNumber(f2.value))
alert("Invalid field entry!");
else{
if(task == "compute")
{
f5.value = f2.value *.05;
f2.value = f2.value *.95;
f3.value = f2.value/2 - f1.value/2;
f4.value = f3.value + f1.value;


}
if(task == "reset"){
f1.value = "";
f2.value = "";
f3.value = "";
f4.value = "";
f5.value = "";
}


}
}
}
-->
</script>
</head>
<body>
<TABLE width=200 height=100 >
<TR>
<TD >
Amount of stake: <input type="Text" id="stake"></br>

Total Amount Cashed: <input type="text" id="cash">
</br>
<input value="Calculate" type="button" onclick="calculate('compute')"/>
<input type="button" value="Clear Fields" onclick="calculate('reset')" />
</br></br></br>
Total to be shipped to site: <input type="text" id="siteshare"></br>
Total to be shipped to staker: <input type="text" id="stakershare"></br>
Total to keep: <input type="text" id="horseshare">
</TR>
</TD>



</TABLE>
</body>
</html>

--------------- Added [DATE]1203650384[/DATE] at [TIME]1203650384[/TIME] ---------------

not accepting the user input, sorry.

--------------- Added [DATE]1203651724[/DATE] at [TIME]1203651724[/TIME] ---------------

any help ANYONE can give me on this who knows about this would be greatly appreciated.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05930 seconds
  • Memory Usage 2,401KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete