-
lplatzAsked on October 19, 2019 at 4:46 PM
Following the article "How to send Submissions to Your MySQL Database Using PHP", I have had good success so far as I work through this process. I have, however, ran into my first challenge.
For my form, I am using the "Address" form element under the "Basic" section. When running the https://www.jotform.com/show-post-data/ to confirm how data will be posted to the database, I come across the following for the address array.
When running the Thank You page, the only address data that is inserted into my mySQL database is the index [0] data. Where is the other index data going? How do I capture the other Address information to my database?
The following is to confirm each of the sections of the Thank You page.
...
ExtendedAddslash($_POST);
...
$address10 =$_POST['address10']['0'];$_POST['address10']['1'];$_POST['address10']['2'];$_POST['address10']['3'];$_POST['address10']['4'];$_POST['address10']['5'];
...if ($resultcount > 0) {
mysql_query("UPDATE `table_name` SET
`fullname` = '$fullname',
`email` = '$email',
`address` = '$address10',
`mobileNumbr` = '$mobileNumbr'
WHERE `submission_id` = '$submission_id'")
or die(mysql_error());
} else {
mysql_query("INSERT INTO `table_name` (submission_id, formID, IP, fullname, address, email, mobileNumbr)
VALUES ('$submission_id', '$formID', '$ip', '$fullname', '$address10', '$email', '$mobileNumbr') ")
or die(mysql_error());I have attempted to research this but unsure how to ask the right question to get some traction for this solution. Any help or direction for finding a solution would be greatly appreciated.
-
jonathanReplied on October 19, 2019 at 7:18 PM
You should use dot(.) instead if you want to concatenate the multiple values into a variable.
In your code you have used semi-colon(;) which immediately ended the script instead.
$address10 =$_POST['address10']['0'];$_POST['address10']['1'];$_POST['address10']['2'];...
$_POST['address10']['3'];$_POST['address10']['4'];$_POST['address10']['5'];
No need also to enclosed the index number in quote (' ')
---
You can see the correct way in the user guide.
Example for the combo Phone Number field.
Please try the correction on your codes and test/check again.
Let us know if this still did not work
-
lplatzReplied on October 19, 2019 at 9:23 PM
Replacing the simi-colon (;) with a dot (.) corrected the issue. Getting the complete address posted to my mySQL table. Thank you for your quick reply/solution.
-
jonathanReplied on October 19, 2019 at 9:34 PM
Thank you for taking the time updating us on the status and letting us know it is working now.