hi people i just programmed a poll. just to give u a better view of my situation this is how i coded it:
<html>
<head>
<script language="javascript">
function calculate() {
if (rock_poll.metallica.value =="on") {
metallica = metallica + 1
document.write("metallica: " + metallica + " <br> ");
document.write("ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns n' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.ac_dc.value =="on") {
ac_dc = ac_dc + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.zeppelin.value =="on"){
zeppelin = zeppelin + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.guns_n_roses.value =="on"){
guns_n_roses = guns_n_roses + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.aerosmith.value =="on"){
aerosmith = aerosmith + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " +tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.nirvana.value =="on"){
nirvana = nirvana + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.tool.value =="on"){
tool = tool + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses " + guns_n_roses + " <br> ");
document.write(aerosmith + " <br> ");
document.write(nirvana + " <br> ");
document.write(tool + " <br> ");
document.write(other + " <br> ");
}
if (rock_poll.other.value =="on"){
other = other + 1
document.write(metallica + " <br> ");
document.write(ac_dc + " <br> ");
document.write(zeppelin + " <br> ");
document.write(guns_n_roses + " <br> ");
document.write(aerosmith + " <br> ");
document.write(nirvana + " <br> ");
document.write(tool + " <br> ");
document.write(other + " <br> ");
}
}
</script>
<title>Untitled</title>
</head>
<body>
<script language="javascript">
var metallica = 0
var ac_dc = 0
var zeppelin = 0
var guns_n_roses = 0
var aerosmith = 0
var nirvana = 0
var tool = 0
var other = 0
</script>
<form name="rock_poll">
What is the best rock band?
<br>
<br>
<input type="checkbox" name="metallica">Metallica
<br>
<input type="checkbox" name="ac_dc">AC/DC
<br>
<input type="checkbox" name="zeppelin">Led Zeppelin
<br>
<input type="checkbox" name="guns_n_roses">Guns N' Roses
<br>
<input type="checkbox" name="aerosmith">Aerosmith
<br>
<input type="checkbox" name="nirvana">Nirvana
<br>
<input type="checkbox" name="tool">Tool
<br>
<input type="checkbox" name="other">Other
<center><input type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"submit and view results" name="submit_poll" onclick="calculate()"</center>
</form>
</body>
</html>
I need some help tho cuz the variables need to be stored on the server, and i dunno how to do this. can any1 help??
<html>
<head>
<script language="javascript">
function calculate() {
if (rock_poll.metallica.value =="on") {
metallica = metallica + 1
document.write("metallica: " + metallica + " <br> ");
document.write("ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns n' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.ac_dc.value =="on") {
ac_dc = ac_dc + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.zeppelin.value =="on"){
zeppelin = zeppelin + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.guns_n_roses.value =="on"){
guns_n_roses = guns_n_roses + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.aerosmith.value =="on"){
aerosmith = aerosmith + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " +tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.nirvana.value =="on"){
nirvana = nirvana + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/Dc: " + ac_dc + " <br> ");
document.write("Zeppelin: " + zeppelin + " <br> ");
document.write("Guns N' Roses: " + guns_n_roses + " <br> ");
document.write("Aerosmith: " + aerosmith + " <br> ");
document.write("Nirvana: " + nirvana + " <br> ");
document.write("Tool: " + tool + " <br> ");
document.write("Other: " + other + " <br> ");
}
if (rock_poll.tool.value =="on"){
tool = tool + 1
document.write("Metallica: " + metallica + " <br> ");
document.write("Ac/dc: " + ac_dc + " <br> ");
document.write("Led Zeppelin " + zeppelin + " <br> ");
document.write("Guns N' Roses " + guns_n_roses + " <br> ");
document.write(aerosmith + " <br> ");
document.write(nirvana + " <br> ");
document.write(tool + " <br> ");
document.write(other + " <br> ");
}
if (rock_poll.other.value =="on"){
other = other + 1
document.write(metallica + " <br> ");
document.write(ac_dc + " <br> ");
document.write(zeppelin + " <br> ");
document.write(guns_n_roses + " <br> ");
document.write(aerosmith + " <br> ");
document.write(nirvana + " <br> ");
document.write(tool + " <br> ");
document.write(other + " <br> ");
}
}
</script>
<title>Untitled</title>
</head>
<body>
<script language="javascript">
var metallica = 0
var ac_dc = 0
var zeppelin = 0
var guns_n_roses = 0
var aerosmith = 0
var nirvana = 0
var tool = 0
var other = 0
</script>
<form name="rock_poll">
What is the best rock band?
<br>
<br>
<input type="checkbox" name="metallica">Metallica
<br>
<input type="checkbox" name="ac_dc">AC/DC
<br>
<input type="checkbox" name="zeppelin">Led Zeppelin
<br>
<input type="checkbox" name="guns_n_roses">Guns N' Roses
<br>
<input type="checkbox" name="aerosmith">Aerosmith
<br>
<input type="checkbox" name="nirvana">Nirvana
<br>
<input type="checkbox" name="tool">Tool
<br>
<input type="checkbox" name="other">Other
<center><input type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"submit and view results" name="submit_poll" onclick="calculate()"</center>
</form>
</body>
</html>
I need some help tho cuz the variables need to be stored on the server, and i dunno how to do this. can any1 help??