dimanche 22 novembre 2015

adding values in check boxes (php)

please help me how to add the values using either php or html please help me how to add the values using either php or html

please help me how to add the values using either php or html

please help me how to add the values using either php or html please help me how to add the values using either php or html

help me

<html>
<head>
<title>Checkboxes</title>
<?PHP
$ch1 = 'unchecked';
$ch2 = 'unchecked';
$ch3 = 'unchecked';
$ch4 = 'unchecked';
$ch5 = 'unchecked';

if (isset($_POST['Submit1'])) {

if (isset($_POST['ch1'])) {
echo $_POST['ch1']; 
$ch1 = $_POST['ch1'];

if ($ch1 == 'net') {
print $ch1;
$ch1 = 'checked';
}
}

if (isset($_POST['ch2'])) {
echo $_POST['ch2']; 
ch2 = $_POST['ch2'];

if ($ch2 == 'word') {
$ch2 = 'checked';
}
}

if (isset($_POST['ch3'])) {
echo $_POST['ch3']; 
$ch3 = $_POST['ch3'];

if ($ch3 == 'excel') {
$ch3 = 'checked';
}
}

if (isset($_POST['ch4'])) {
echo $_POST['ch4']; 
$ch4 = $_POST['ch4'];

if ($ch4 == 'web') {
$ch4 = 'checked';
}
}

if (isset($_POST['ch5'])) {
echo $_POST['ch5']; 
$ch5 = $_POST['ch5'];

if ($ch5 == 'php') {
$ch5 = 'checked';
}
}
}

?>


</head>

<body>

<FORM NAME ="form1" METHOD ="POST" ACTION ="Faraji_Nima_Ex4-111.php">

this is where is prints out the value basketball $15

tennisball $50

baseball 150

soccerball $2

softball $4

<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Choose your favorite balls"

</FORM>

</body>
</html>




Aucun commentaire:

Enregistrer un commentaire