继续本主题 (php) How can put button to get new inputing field (picture inside)
现在我想知道如何获取数据并将其插入我的数据库
这是我用于表单页面的代码
<b><u> Education </u></b>
<form method="post" action="Resume_data_form_2_confirm.php">
<div id="main_wrap">
<div id="clone">
<br>Education Level :
<select name="education[]">
<option value="bachelor" selected="selected">Bachelor Degree</option>
<option value="master">Master Degree</option>
<option value="doctor">Doctoral Degree</option>
</select>
Major : <input type="text" name="edu_major[]" placeholder=''>
Faculty : <input type="text" name="edu_faculty[]" placeholder=''>
<br>
<br>
University : <input type="text" name="edu_university[]" placeholder=''>
Education Hounour :
<select name="edu_honour[]">
<option value="none" selected="selected">None</option>
<option value="cum_laude">Cum Laude</option>
<option value="magna">Magna Cum Laude</option>
<option value="summa">Summa Cum Laude</option>
</select>
Graduated Year :
<select name="year[]">
<?php
$curYear = getdate();
for($year = 1990 ; $year <= $curYear['year']; $year++){
?>
<OPTION value = '<?php echo $year;?>'> <?php echo $year;?> </OPTION>
<?php
}
?>
</select>
</div>
<div style="float:right;">
<input type="button" value="+" id="more" style="float:right;">
</div>
<br>
<br>
<div style="float:right;">
<input type="submit" name="confirm" value="Confirm" style="float:right;">
</div>
</div>
</form>
如您所见,我在代码中有一个克隆功能。我的问题是:如何将此数据插入我的数据库。
假设Username为“Test”且Education_ID自动递增,点击“确认”按钮后,它应该存储在我的数据库中,如下所示:
Education_ID(1) Username(2) Edu_Level(3) Edu_Major(4) Edu_Faculty(5) Edu_University(6) Edu_Honour(7) Edu_Graduated_Year(8).
00001(1) Test(2) bachelor(3) IT(4) Computer Science(5) Cambridge University(6) cum_laude(7) 2008(8)
00002(1) Test(2) master(3) IT(4) Science and Technology(5) University of London(6) none(7) 2011(8)
答案 0 :(得分:0)
您已发布到Resume_data_form_2_confirm.php。因此,数据将被发送到该PHP文件。从那里,您可以获取您提交的数据,与数据库建立连接,为数据编写插入查询,然后执行查询。我很抱歉这是一个非常高级别的解释,但您应该能够在网上为我所说的每一步找到更多代码特定的详细信息。祝你好运!