Hello
I have PHP file that contain HTML form.
Every thing is ok on it, but the problem is when I want make checkbox.
There is 8 checkbox and man can only choose 3 of them and then be sent with whole information by e-mail.
Question 1:
Well, I send you code and I hope you can remove the Javascript code and write instead on Perl.
Question 2:
How can I show with checkbox is on?
Here is the code include example that will show result:
<?php
?>
<html>
<script type="text/javascript">
function check(){
kott=document.forms[0].kott
a=0
for (i=0;i<8;++ i)
{
if (kott.checked)
{
a=a+1
}
}
if (a > 3)
{
alert("You did choose more than 3 of 8.\nYou have to choose only 3.")
}
}
</script>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table width="600"><tr>
<div align="left">
<input type="checkbox" name="kott" value="0" alt="Rostbiff" onClick="check()">Rostbiff</div>
<div>
<input type="checkbox" name="kott" value="1" alt="Fläskfilé" onClick="check()">Fläskfilé</div>
<div>
<input type="checkbox" name="kott" value="2" alt="Kycklingfilé;" onClick="check()">Kycklingfilé;</div>
<div>
<input type="checkbox" name="kott" value="3" alt"Kycklingklubbor" onClick="check()">Kycklingklubbor</div>
<div>
<input type="checkbox" name="kott" value="4" alt="Kalkonfilé" onClick="check()">Kalkonfilé</div>
<div>
<input type="checkbox" name="kott" value="5" alt"Rökt skinka" onClick="check()">Rökt skinka</div>
<div>
<input type="checkbox" name="kott" value="6" alt"Gourmet Skinka" onClick="check()">Gourmet Skinka</div>
<div>
<input type="checkbox" name="kott" value="7" alt"Kassler" onClick="check()">Kassler</div>
</tr>
<td>
<div align="center">
<input type="reset" name="reset" value="Rest">
<input type="submit" name="submit" value="Print down the checkbox that is ON" >
</div></td></table></form>
<br>
Example printing will show result that is on: <br>
You did choose the following: <strong>Rostbiff , Rökt skinka and Gourmet Skinka</strong>
</body>
</html>
<?php
?>
I have PHP file that contain HTML form.
Every thing is ok on it, but the problem is when I want make checkbox.
There is 8 checkbox and man can only choose 3 of them and then be sent with whole information by e-mail.
Question 1:
Well, I send you code and I hope you can remove the Javascript code and write instead on Perl.
Question 2:
How can I show with checkbox is on?
Here is the code include example that will show result:
<?php
?>
<html>
<script type="text/javascript">
function check(){
kott=document.forms[0].kott
a=0
for (i=0;i<8;++ i)
{
if (kott.checked)
{
a=a+1
}
}
if (a > 3)
{
alert("You did choose more than 3 of 8.\nYou have to choose only 3.")
}
}
</script>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table width="600"><tr>
<div align="left">
<input type="checkbox" name="kott" value="0" alt="Rostbiff" onClick="check()">Rostbiff</div>
<div>
<input type="checkbox" name="kott" value="1" alt="Fläskfilé" onClick="check()">Fläskfilé</div>
<div>
<input type="checkbox" name="kott" value="2" alt="Kycklingfilé;" onClick="check()">Kycklingfilé;</div>
<div>
<input type="checkbox" name="kott" value="3" alt"Kycklingklubbor" onClick="check()">Kycklingklubbor</div>
<div>
<input type="checkbox" name="kott" value="4" alt="Kalkonfilé" onClick="check()">Kalkonfilé</div>
<div>
<input type="checkbox" name="kott" value="5" alt"Rökt skinka" onClick="check()">Rökt skinka</div>
<div>
<input type="checkbox" name="kott" value="6" alt"Gourmet Skinka" onClick="check()">Gourmet Skinka</div>
<div>
<input type="checkbox" name="kott" value="7" alt"Kassler" onClick="check()">Kassler</div>
</tr>
<td>
<div align="center">
<input type="reset" name="reset" value="Rest">
<input type="submit" name="submit" value="Print down the checkbox that is ON" >
</div></td></table></form>
<br>
Example printing will show result that is on: <br>
You did choose the following: <strong>Rostbiff , Rökt skinka and Gourmet Skinka</strong>
</body>
</html>
<?php
?>