View Full Version : Notice: Undefined index:

09-25-2014, 10:15 AM
Hi everyone

I have a form which post to a phpmyadmn database. I have made forms in the past but with this form I am getting this error. :(

Notice: Undefined index: logged by in C:\xampp\htdocs\TSWeb\admin\IT\support\newticket.p hp on line 180

Notice: Undefined index: assigned to in C:\xampp\htdocs\TSWeb\admin\IT\support\newticket.p hp on line 181
Column 'logged by' cannot be null

"Logged by" is a text field and "assigned to" is a drop down list.

When I submit my form both fields have an entry.

I have rebuilt the form and the table in the database twice and am getting this every time.

After 2 weeks of frustration and not finding the solution on Google, I would appreciate your assistance

Thank you for your help in advance.

Here is the PHP code

175 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Support Log")) {
176 $insertSQL = sprintf("INSERT INTO `it_support log` (user, category, issue, `logged by`, `assigned to`) VALUES (%s, %s, %s, %s, %s)",
177 GetSQLValueString($_POST['user'], "text"),
178 GetSQLValueString($_POST['category'], "text"),
179 GetSQLValueString($_POST['issue'], "text"),
180 GetSQLValueString($_POST['logged by'], "text"),
181 GetSQLValueString($_POST['assigned to'], "text"));
183 mysql_select_db($database_connTSweb, $connTSweb);
184 $Result1 = mysql_query($insertSQL, $connTSweb) or die(mysql_error());
186 $insertGoTo = "supportlog.php";
187 if (isset($_SERVER['QUERY_STRING'])) {
188 $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
189 $insertGoTo .= $_SERVER['QUERY_STRING'];
190 }
191 header(sprintf("Location: %s", $insertGoTo));
192 }

09-29-2014, 01:23 AM
line 180 180 GetSQLValueString($_POST['logged by'], "text"),

i would change logged by to logged_by and all references to it
you can run a $print_r($_POST); to see what values are actually being received