Hi,
I am really new to php and could do with some help. Below is a simple poll script I am using (I didnt write this myself) and what I want to do is show another figure just below the percentage. This would be the vote % converted into betting odds so if enough people vote we can tell if the selection represents value. The calculation would be: 1/pecentage * 100" = decimal odds.
If somebody could tell me what code and where is would go I would be eternally grateful.
Thanks
[php]
[/php][code]// JavaScript Document
// only accept alpha numeric, “-” and “"
poll_id = poll_id.replace(/[^a-z0-9-]/gi,”_");
// create a div with the ID same as poll_id, we will display the poll in it
document.write(’’);
// a function that retruns the full path of current .js file
var js_script_url = (function(){
var scripts = document.getElementsByTagName(‘script’), script = scripts[scripts.length - 1];
if (script.getAttribute.length !== undefined) {
return script.getAttribute(‘src’)
}
return script.getAttribute(‘src’, 2)
}());
// get the working directory of this js script, to be able to redirect to poll.php properly
last_slash_position = js_script_url.lastIndexOf("/");
script_directory = js_script_url.slice(0,last_slash_position+1);
$variables_string = “?poll_id=”+poll_id+"&poll_question="+poll_question+"&poll_titles="+poll_titles+"&poll_images="+poll_images;
// load the iframe
document.getElementById(poll_id).src = script_directory +“poll.php”+$variables_string;
[/code]