bizfreak22 Posted August 9, 2011 Share Posted August 9, 2011 Hey guys, I am a newbie, really need your help. I've been working on this for 2 days and can't get it to work correctly. I have a form that I want to submit to the database "New Lead" form. I am using the submodal feature for the customer notes. For some reason, the data is not inserting correctly into the database, I keep getting an error which says undefined index "Notes." Here is the code that I am using for the table form, and also the insert statement...please help! 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> </td> <td><input type="submit" name="Submit" id="Submit" value="Submit" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/244341-having-a-tough-time-inserting-data-into-the-database/ Share on other sites More sharing options...
JasonLewis Posted August 9, 2011 Share Posted August 9, 2011 The error is in reference to the fact the the $_POST superglobal does not contain a key named 'notes'. In your form, you have "Notes:" There is no input field for this, instead you have what appears to be an image/link to another page. Perhaps you were not meant to insert the notes there? Quote Link to comment https://forums.phpfreaks.com/topic/244341-having-a-tough-time-inserting-data-into-the-database/#findComment-1254998 Share on other sites More sharing options...
bizfreak22 Posted August 9, 2011 Author Share Posted August 9, 2011 Thanks for the reply! I meant to put notes in there, the notes are meant to be inputted in the Submodal window that pops up once I click on the Image.....for some reason when I access the form, I am not able to submit the information to the database... Quote Link to comment https://forums.phpfreaks.com/topic/244341-having-a-tough-time-inserting-data-into-the-database/#findComment-1255006 Share on other sites More sharing options...
jcbones Posted August 10, 2011 Share Posted August 10, 2011 I don't see any database interaction in your script. You build the query, but never send it to the database. Perhaps you left some of the script out, because Dreamweaver usually writes that in for you. Quote Link to comment https://forums.phpfreaks.com/topic/244341-having-a-tough-time-inserting-data-into-the-database/#findComment-1255115 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.