我是 php 和 mysql 的初学者,在一种情况下我需要你的帮助。我有一个带有单选按钮的表单,实际上是一个星级评分系统,我想通过 ajax 调用将表单提交到 mysql 数据库。我不知道如何进行 ajax 调用和用于插入 mysql 的 php。请帮忙!
我的代码是:
<div class="Clear"> </div>
<form id="form1">
Question 1:bla bla bla
<input class="star required" type="radio" name="Question 1" value="1"/>
<input class="star" type="radio" name="Question 1" value="2"/>
<input class="star" type="radio" name="Question 1" value="3"/>
<input class="star" type="radio" name="Question 1" value="4"/>
<input class="star" type="radio" name="Question 1" value="5"/>
</div>
<br/>
<div class="Clear">
Question 2:bla bla bla
<input class="star required" type="radio" name="Question 2" value="1"/>
<input class="star" type="radio" name="Question 2" value="2"/>
<input class="star" type="radio" name="Question 2" value="3"/>
<input class="star" type="radio" name="Question 2" value="4"/>
<input class="star" type="radio" name="Question 2" value="5"/>
</div>
<br/>
<div class="Clear">
Question 3:bla bla bla
<input class="star required" type="radio" name="Question 3" value="1"/>
<input class="star" type="radio" name="Question 3" value="2"/>
<input class="star" type="radio" name="Question 3" value="3"/>
<input class="star" type="radio" name="Question 3" value="4"/>
<input class="star" type="radio" name="Question 3" value="5"/>
</div>
<br>
<div class="Clear">
Question 4:bla bla bla
<input class="star required" type="radio" name="Question 4" value="1" />
<input class="star" type="radio" name="Question 4" value="2" />
<input class="star" type="radio" name="Question 4" value="3" />
<input class="star" type="radio" name="Question 4" value="4" />
<input class="star" type="radio" name="Question 4" value="5" />
</div>
<br/>
<div class="Clear">
Question 5:bla bla bla
<input class="star required" type="radio" name="Question 5" value="1"/>
<input class="star" type="radio" name="Question 5" value="2"/>
<input class="star" type="radio" name="Question 5" value="3"/>
<input class="star" type="radio" name="Question 5" value="4"/>
<input class="star" type="radio" name="Question 5" value="5"/>
</div>
<br/>
<div class="Clear">
Question 6:bla bla bla
<input class="star required" type="radio" name="Question 6" value="1" />
<input class="star" type="radio" name="Question 6" value="2" />
<input class="star" type="radio" name="Question 6" value="3" />
<input class="star" type="radio" name="Question 6" value="4" />
<input class="star" type="radio" name="Question 6" value="5" />
</div>
<input type="submit" value="Submit scores!" /> </td>
</form>
</body>
</html>