Ich habe eine Lösung gefunden, dank euch! Ich habe noch ein hidden input inzugefügt der bei default checked ist:
HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rating</title>
<style>
#form_wrapper fieldset label {
unicode-bidi: bidi-override;
direction: ltr;
}
#form_wrapper fieldset {
border:none;
padding:0;
}
#form_wrapper legend {
margin-top:11px;
width:100px;
float:left;
}
#form_wrapper fieldset label:before {
content:"\2605" ;
color:gold;
font-size:2rem;
}
#form_wrapper fieldset input:checked ~ label:before {
content:"\2606" ;
color:black;
}
#form_wrapper fieldset input {
display:none;
}
#form_wrapper select {
display:block;
}
.hideMe {
display:none;
}
</style>
</head>
<body>
<form id="form_wrapper" name="" action="" method="get">
<fieldset>
<legend>Price:</legend>
<label for="price_star_0" class="hideMe"></label><input type="radio" name="price" id="price_star_0" checked>
<label for="price_star_1"></label><input type="radio" name="price" id="price_star_1" value="1">
<label for="price_star_2"></label><input type="radio" name="price" id="price_star_2" value="2">
<label for="price_star_3"></label><input type="radio" name="price" id="price_star_3" value="3">
<label for="price_star_4"></label><input type="radio" name="price" id="price_star_4" value="4">
<label for="price_star_5"></label><input type="radio" name="price" id="price_star_5" value="5">
</fieldset>
<fieldset>
<legend>Scalability:</legend>
<label for="scalability_star_0" class="hideMe"></label><input type="radio" name="scalability" id="scalability_star_0" checked>
<label for="scalability_star_1"></label><input type="radio" name="scalability" id="scalability_star_1" value="1">
<label for="scalability_star_2"></label><input type="radio" name="scalability" id="scalability_star_2" value="2">
<label for="scalability_star_3"></label><input type="radio" name="scalability" id="scalability_star_3" value="3">
<label for="scalability_star_4"></label><input type="radio" name="scalability" id="scalability_star_4" value="4">
<label for="scalability_star_5"></label><input type="radio" name="scalability" id="scalability_star_5" value="5">
</fieldset>
<input type="submit" name="action" value="Get">
</form>
</body>
</html>
Alles anzeigen
Übertragen in PHP sieht das Ganze vor dem Aufräumen des Codes derzeit so aus:
PHP
<div id="form_wrapper">
<form name="techform" action={{ '/tech/'.$id }} method="post">
{{csrf_field()}}
<div class="form_row">
<div class="form_links">
<table>
@foreach($criteria as $crit)
<tr>
<td>
<label for="$crit">{{ $crit->criteria }}:</label>
</td>
<td>
<fieldset>
<label for="{{ $crit->criteria."_0" }}" class="hideMe"></label>
<input type="radio" name="{{ "score_".$crit->criteria_id }}" id="{{ $crit->criteria."_0" }}" value="0"
@if(count($qscore) == 0 || $qscore[0]->criteria_id != $crit->criteria_id)
checked
@endif
>
@for($i = 1; $i <= 5; $i++)
<input type="hidden" name="{{ "criteria_id_".$crit->criteria_id }}" value="{{ $crit->criteria_id }}">
<label for="{{ $crit->criteria."_".$i }}"></label>
<input type="radio" name="{{ "score_".$crit->criteria_id }}" id="{{ $crit->criteria."_".$i }}" value="{{ $i }}"
@foreach($qscore as $score)
@if(isset($score->criteria_id) &&($score->criteria_id == $crit->criteria_id) && ($score->score == $i))
checked
@endif
@endforeach
>
@endfor
</fieldset>
</td>
</tr>
@endforeach
<tr></tr>
<tr>
<td>
Level:
<select name="level">
<option value="1" @if($tech->level_id == 1) selected @endif >Strategic</option>
<option value="2" @if($tech->level_id == 2) selected @endif >Tactical</option>
<option value="3" @if($tech->level_id == 3) selected @endif >Operative</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" name="action" value="Save">
</td>
</tr>
</table>
@include ('layouts.errors')
</div>
</div>
</form>
</div>
Alles anzeigen
Nochmal vielen Dank djheke und Arne Drews für eure Hilfe