Nieuw lid |
|
Mjah, ik vind jouw code niet echt lekker lezen, veel te veel irrelevante code..
Een werkend voorbeeldje (als ik je goed snap iig)
<?php
$database_string = "10-20-30-40";
if(isset($_POST['go']))
{
if(isset($_POST['optie']))
{
$array_values = explode("-", $database_string);
switch ($_POST['optie'])
{
case 1:
$erbij = 1;
$array_values[0] += $erbij;
break;
case 2:
$erbij = 2;
$array_values[1] += $erbij;
break;
case 3:
$erbij = 3;
$array_values[2] += $erbij;
break;
case 4:
$erbij = 4;
$array_values[3] += $erbij;
break;
}
echo implode("-", $array_values);
}
else
{
echo 'kies iets..';
}
}
?>
<form action="" method="post">
1<input name="optie" type="radio" value="1" />
2<input name="optie" type="radio" value="2" />
3<input name="optie" type="radio" value="3" />
4<input name="optie" type="radio" value="4" />
<input name="go" type="submit" />
</form>
<?php $database_string = "10-20-30-40"; { if(isset($_POST['optie'])) { $array_values = explode("-", $database_string); switch ($_POST['optie']) { case 1: $erbij = 1; $array_values[0] += $erbij; break; case 2: $erbij = 2; $array_values[1] += $erbij; break; case 3: $erbij = 3; $array_values[2] += $erbij; break; case 4: $erbij = 4; $array_values[3] += $erbij; break; } } else { } } ?> <form action="" method="post"> 1<input name="optie" type="radio" value="1" /> 2<input name="optie" type="radio" value="2" /> 3<input name="optie" type="radio" value="3" /> 4<input name="optie" type="radio" value="4" /> <input name="go" type="submit" /> </form>
|