Insert Record from hidden form element
Hi Ray and Jason:
I've got a website that's just about ready to go live, but I'm experiencing one little glitch in the contact form that I'm sure you can help me to sort out.
I'm using the MySQLi Insert Record Server Behavior on the contact.php page and all of the data from the non-hidden elements is being inserted properly in the database.
First I use the Insert Record to insert visitor data such as fullname, email, regDate and pgSrc (the last two are the date as defined by
<?php echo(date("Y-m-d H:i:s")); ?> and a page source number (integer) that tell me which page the user was on when they submitted the form.
Currently this SB is working fine. It's purpose is mainly to set a session variable for the visitorID which is then inserted into the second Insert record SB which inserts the visitorID session, fullname, email, phone, subject and message into the messages table. This SB is not inserting the regDate and pgSrc (page source number).
I'm using an AJAX Contact form/script as the source for my data which is on a mega menu. The form posts to the contact.php where the insert record server behaviors appear with some other scripts that validate the form and configure the email to be sent to various parties. a jQuery script is called from the containing page which animates the loading of the confirmation in the menu.
When I submit the form, the AJAX loads the confirmation script from the contact.php and the email is sent, the data is inserted (except for the two hidden element's data) and I get this notification:
Notice: Undefined index: visitorID in <path>/contact.php on line 26
Notice: Undefined index: regDate in <path>/contact.php on line 57
Notice: Undefined index: pgSrc in <path>/contact.php on line 58
I'm not sure why I'm getting these as the visitorID is getting set in the database and the SB checks to see if the value isset from the $_POST.
I've attached the three files that make this work. Any pointers will help as always!
enthusiastically,
Mark.