就在一周前,我还不知道发生了什么变化。我们有一个电影数据库,里面有一组单选按钮来给电影打分。每一组单选按钮共享正在分级的电影的名称,因此每一组都是一个不同的组。点击submit时,会为每部电影添加一个分级表条目,但不会传递分级。
单选按钮代码:
<div id='stars'>
<input class='star star-6' id='{$NewID}-6' type='radio' name='{$row['MovieID']}' value='5'/>
<label class='star star-6' for='{$NewID}-6'></label>
<input class='star star-5' id='{$NewID}-5' type='radio' name='{$row['MovieID']}' value='4'/>
<label class='star star-5' for='{$NewID}-5'></label>
<input class='star star-4' id='{$NewID}-4' type='radio' name='{$row['MovieID']}' value='3'/>
<label class='star star-4' for='{$NewID}-4'></label>
<input class='star star-3' id='{$NewID}-3' type='radio' name='{$row['MovieID']}' value='2'/>
<label class='star star-3' for='{$NewID}-3'></label>
<input class='star star-2' id='{$NewID}-2' type='radio' name='{$row['MovieID']}' value='1'/>
<label class='star star-2' for='{$NewID}-2'></label>
<input class='star star-1 not' id='{$NewID}-1' type='radio' name='{$row['MovieID']}' value='notseen'/>
<label class='star star-1 not' for='{$NewID}-1'></label>
</div>
sql更新代码:
$pushrating = "INSERT INTO Ratings (Username, MovieID, Rating) VALUES ('{$user}', '{$row['MovieID']}', '{$_POST[$row['MovieID']]}')";
mysqli_query($db, $pushrating);
暂无答案!
目前还没有任何答案,快来回答吧!