Hey i just need abit of help making some php code
so here we go:
i made a form of check boxes
i need some help
<form action="verify-form.php" method="post">
<p>Which product(s) would you like to buy?<br />
<input type="checkbox" name="dvd[]" value="<br>box1<br/>"
<?PHP print $ch1; ?> />
box1 $20<br />
<input type="checkbox" name="dvd[]" value="<br>box2<br/>"
<?PHP print $ch2; ?> />
box2 $25<br />
<input type="checkbox" name="dvd[]" value="<br>box3<br/>"
<?PHP print $ch3; ?> />
box3 $30<br />
<input type="checkbox" name="dvd[]" value="<br>box4<br/>"
<?PHP print $ch4; ?> />
box4 $35<br />
<input type="submit" name="formSubmit" value="Submit" />
</p>
</form>
thats my form
now i want to put another form under each box that lets you choose the amount of products that you want and i want to display an error if anything but a whole integer (number) is displayed and no letters and if you put 0 it will come up with an error
thats my first part
_________________________________________________________________________________
<?php
// retrieve form data
$check = $_POST['box'];
// check entered value and branch
if(empty($check))
{
echo("You didn't select any products.");
}
else
{
$N = count($check);
echo("You selected $N product(s): ");
for($i=0; $i < $N; $i++)
{
echo($check[$i] . " ");
}
}
?>
thats my second page and that displays the boxes that are selected on the first page
i want the second page to display the sum of all the products that i selected using my check boxes
so if i chose box 1( 2x ) and box 2 ( 3x )
and i want the php to add the sum up of all the boxes (and how many i chose) up and make a total
if someone can help me do this little code it would be great
you dont have to make it fancy just help me put the total a few spaces under the info thats there
thanks
so here we go:
i made a form of check boxes
i need some help
<form action="verify-form.php" method="post">
<p>Which product(s) would you like to buy?<br />
<input type="checkbox" name="dvd[]" value="<br>box1<br/>"
<?PHP print $ch1; ?> />
box1 $20<br />
<input type="checkbox" name="dvd[]" value="<br>box2<br/>"
<?PHP print $ch2; ?> />
box2 $25<br />
<input type="checkbox" name="dvd[]" value="<br>box3<br/>"
<?PHP print $ch3; ?> />
box3 $30<br />
<input type="checkbox" name="dvd[]" value="<br>box4<br/>"
<?PHP print $ch4; ?> />
box4 $35<br />
<input type="submit" name="formSubmit" value="Submit" />
</p>
</form>
thats my form
now i want to put another form under each box that lets you choose the amount of products that you want and i want to display an error if anything but a whole integer (number) is displayed and no letters and if you put 0 it will come up with an error
thats my first part
_________________________________________________________________________________
<?php
// retrieve form data
$check = $_POST['box'];
// check entered value and branch
if(empty($check))
{
echo("You didn't select any products.");
}
else
{
$N = count($check);
echo("You selected $N product(s): ");
for($i=0; $i < $N; $i++)
{
echo($check[$i] . " ");
}
}
?>
thats my second page and that displays the boxes that are selected on the first page
i want the second page to display the sum of all the products that i selected using my check boxes
so if i chose box 1( 2x ) and box 2 ( 3x )
and i want the php to add the sum up of all the boxes (and how many i chose) up and make a total
if someone can help me do this little code it would be great
you dont have to make it fancy just help me put the total a few spaces under the info thats there
thanks