gpt4 book ai didi

php - 无法正确插入数据库,请帮忙

转载 作者:行者123 更新时间:2023-11-29 14:45:43 25 4
gpt4 key购买 nike

我是新手,非常需要您的帮助。我已经为此工作了 2 天,但无法使其正常工作。我有一个表格要提交到数据库“新潜在客户”表格。我正在使用客户备注的子模式功能。由于某种原因,数据没有正确插入到数据库中,我不断收到一条错误,提示未定义索引“注释”。这是我用于表格表单的代码,还有插入语句...请帮忙!

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO Leads (First_Name, Last_Name, Address, City, `State`, Zip, Phone,
Email, Fee, Referral_Source, Notes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['First_Name'], "text"),
GetSQLValueString($_POST['Last_Name'], "text"),
GetSQLValueString($_POST['Address'], "text"),
GetSQLValueString($_POST['City'], "text"),
GetSQLValueString($_POST['State'], "text"),
GetSQLValueString($_POST['Zip'], "text"),
GetSQLValueString($_POST['Phone'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Fee'], "int"),
GetSQLValueString($_POST['Referral_Source'], "text"),
GetSQLValueString($_POST["Notes"], "text"));


<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" target="_top" id="form1">


<table width="30%%" border="1">
<tr>
<td>First Name:</td>
<td><label for="First_Name"></label>
<input type="text" name="First_Name" id="First_Name" /></td>
</tr>
<tr>
<td>Last Name:</td>
<td><label for="Last_Name"></label>
<input type="text" name="Last_Name" id="Last_Name" /></td>
</tr>
<tr>
<td>Address:</td>
<td><label for="Address"></label>
<input type="text" name="Address" id="Address" /></td>
</tr>
<tr>
<td>City:</td>
<td><label for="City"></label>
<input type="text" name="City" id="City" /></td>
</tr>

<tr>
<td>Zip:</td>
<td><label for="Zip"></label>
<input type="text" name="Zip" id="Zip" /></td>
</tr>
<tr>
<td>Phone:</td>
<td><label for="Phone"></label>
<input type="text" name="Phone" id="Phone" /></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><label for="Email"></label>
<input type="text" name="Email" id="Email" /></td>
</tr>
<tr>
<td>Fee:</td>
<td><label for="Fee"></label>
<input type="text" name="Fee" id="Fee" /></td>
</tr>
<tr>
<td>Referral Source:</td>
<td><label for="Referral_Source"></label>
<input type="text" name="Referral_Source" id="Referral_Source" /></td>
</tr>
<tr>
<td>Notes:</td>
<td><a href="subform.php?Id=<?php echo $row_Recordset1['Id']; ?>" class="submodal"><img
src="Images/editnote.png" class="pencil" width="33" height="33" /></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" id="Submit" value="Submit" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>

最佳答案

您的表单中没有名为 Notes 的输入。您应该在提交之前使用带有子模式的回调将隐藏元素插入表单中。

http://code.google.com/p/submodal/wiki/UsingCallbackFunction

关于php - 无法正确插入数据库,请帮忙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7000394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com