请帮忙,将我的文本字段中的数据与我的文本区域结合到数据库中不起作用,
请帮助如何正确组合我的价值观。我似乎无法弄清楚如何将我的文本区域的内爆和来自文本字段的其他值结合起来。
下面是我的PHP代码:
$Category2 = $_POST['Category2'];
$Category3 = $_POST['Category3'];
$Status = $_POST['Status'];
$Date = $_POST['Date'];
$Severity = $_POST['Severity'];
$BanType = $_POST['BanType'];
$XiD = $_POST['XiD'];
$Ticket = $_POST['Ticket'];
//Process the input textareas into arrays
$PhoneNumber = array_map('mysql_real_escape_string', explode("\n", $_POST['PhoneNumber']));
$Createdate = array_map('mysql_real_escape_string', explode("\n", $_POST['Createdate']));
$RemedyTicketNo = array_map('mysql_real_escape_string', explode("\n", $_POST['PhoneNumber']));
//Determine the values with the least amoutn of elements
$min_count = min($PhoneNumber, $Createdate, $RemedyTicketNo);
//Create array to hold INSERT values
$values = array();
//Create the INSERT values
for($index=0; $index<$min_count; $index++)
{
$values[] = "('$RemedyTicketNo[$index]','$PhoneNumber[$index]','$Createdate[$index]',
'$Category2','$Category3','$Status','$Date','$Severity','$BanType','$XiD')";
}
$sql=mysql_query("INSERT into tbl_main
(ars_no,phone_number,create_date,category_1,category_2,status,resolved_date,trouble_type_priority,ban_type,employee_id_name)
VALUES " . implode (',',$values));
if (!$sql) {
die('Invalid query: ' . mysql_error());
}
header("Location: smp_backend_test.php");
}
这是我的 html 代码:这有文本字段,
<td colspan="2"><form id="form1" name="form1" method="post" action="" onsubmit="return validateDBLoad()">
<table width="435" border="0">
<tr>
<td width="115"><div align="left" style="font-size:12px"></div></td>
<td width="167" align="left"> </td>
<td width="139" align="right"><input type="reset" name="Clear" id="Clear" value="Clear" /></td>
</tr>
<tr>
<td height="24" style="font-size:12px"><strong>Ticket Source:</strong></td>
<td colspan="2"><select name="Ticket" id="Ticket">
<option value="tickettracker.php">Please select...</option>
<option value="wireless_new.php">Wireless - Remedy</option>
<option value="smp_backend_test.php" selected="selected">SMP - Backend</option>
</select>
<input type="submit" value="Go" id="submit"/></td>
</tr>
<tr>
<td height="24" style="font-size:12px"><strong>Date:</strong></td>
<td colspan="2">
<label for="datepickerID"></label>
<input type="text" name="Date" id="Date" /></td>
</tr>
<tr>
<td style="font-size:12px"><strong>XiD, Name:</strong></td>
<td colspan="2"><span style="font-size:12px">
<select name="XiD" id="XiD">
<option value="Blank" selected="selected">Please Select...</option>
<option value="AAA">AAA</option>
<option value="BBB">BBB</option>
<option value="CCC">CCC</option>
</select>
</span></td>
</tr>
<tr>
<td style="font-size:12px"><strong>Category 2:</strong></td>
<td colspan="2"><input type="text" name="Category" id="Category" value="SMP_Backend" disabled="disabled" /> <input type="hidden" name="Category2" id="Category2" value="SMP_Backend" />
</td>
</tr>
<tr>
<td style="font-size:12px"><strong>Category 3:</strong></td>
<td colspan="2"><label for="Category3"></label>
<select name="Category3" id="Category3">
<option value="Blank" selected="selected">Please Select...</option>
<option value="Pending Request">Pending Request</option>
<option value="Validation Error | Aging">Validation Error|Aging</option>
<option value="Validation Error | RCM">Validation Error|RCM</option>
<option value="Validation Error | Lost Stolen">Validation Error|Lost Stolen</option>
</select></td>
</tr>
<tr>
<td style="font-size:12px"><strong>Status:</strong></td>
<td colspan="2"><input name="Status1" type="text" id="Status1" value="Resolved" disabled="disabled" />
<input name="Status" type="hidden" id="Status" value="Resolved" />
</td>
</tr>
<tr>
<td style="font-size:12px"><strong>Severity:</strong></td>
<td colspan="2"><input type="text" name="SeverityX" id="SeverityX" value="5" size="5" disabled="disabled"/>
<input type="hidden" name="Severity" id="Severity" value="5" size="5" />
</td>
</tr>
<tr>
<td style="font-size:12px"><strong>Ban Type:</strong></td>
<td colspan="2"><span style="font-size:12px">
<input type="text" name="BanType2" id="BanType2" value="I" size="5" disabled="disabled"/>
<input type="hidden" name="BanType" id="BanType" value="I" size="5" />
</span></td>
</tr>
<tr>
<td style="font-size:12px"><strong>Phone No.:</strong></td>
<td style="font-size:12px"><strong>Create Date:</strong></td>
<td style="display:none" >RemedyTicketNo</td>
</tr>
//这是我的文本区域:
<tr>
<td style="font-size:12px"><textarea name="PhoneNumber" id="PhoneNumber" cols="15" rows="5"></textarea></td>
<td><textarea name="Createdate" id="Createdate" cols="25" rows="5"></textarea></td>
<td style="display:none"><textarea type=hidden name="RemedyTicketNo" id="RemedyTicketNo" cols="15" rows="5"></textarea>
</td>
</tr>
<tr>
<td style="font-size:12px"> </td>
<td colspan="2"><span style="font-size:12px">
<input name="DBLoad" type="submit" id="DBLoad" value="DB Load" />
</span></td>
</tr>
</table>
</form></td>