我希望连接两个Textbox值并以不同的名称存储同一个表,同时插入查询
例如
$Standard= $_POST['Standard'];
$division = $_POST['division'];
$RollNo = $_POST['RollNo'];
$Year = $_POST['Year'];
$Class_ID = $Standard.$division.$Year;
$Student_ID = $Class_ID.$RollNo;
<form action="#" method="POST">
<label>Standard</label>
<input type="text" name="Standard">
<label>division</label>
<input type="text" name="division">
<label>Roll No</label>
<input type="text" name="RollNo">
<label>Year</label>
<?php
$already_selected_value = 1984;
$earliest_year = 1990;
print '<select name="Year">';
foreach (range(date('Y'), $earliest_year) as $x) {
print '<option value="'.$x.'"'.($x === $already_selected_value ? ' selected="selected"' : '').'>'.$x.'</option>';
}
print '</select>';
?>
</div>
<button type="submit" class="btn btn-default w3ls-button" name="button">Submit</button>
</form>
此处我有Textbox
标准,分区,RollNo
和Year
,我创建了一个用于从文本框中获取数据的变量。但是在这里我还在class_Id中创建了两个额外的变量$Class_ID
,$Student_ID
,并且我希望连接$Standard+$division+$Year
和$Student_ID = $Class_ID+$RollNO
然后我想在表中插入所有值:
$sql = "INSERT INTO `class`(Student_ID, Class_ID, Standard, division, RollNo, Year) VALUES ('$Student_ID','$Class_ID','$Standard','$division','$RollNo','$Year')";