Hi,
how can I save the IP address into DB table when user submit form with Chronoforms V5?
Thanks in advice.
how can I save the IP address into DB table when user submit form with Chronoforms V5?
Thanks in advice.
Hi deltafidesign,
Use PHPMyAdmin to add a column named ip_address of type VARCHAR(16) to your table.
Add a Custom Code action before the DB Save action and add this code to it:
This replicates the code from CFv4
Bob
Use PHPMyAdmin to add a column named ip_address of type VARCHAR(16) to your table.
Add a Custom Code action before the DB Save action and add this code to it:
<?php
$form->data['ip_address'] = $_SERVER['REMOTE_ADDR'];
?>
This replicates the code from CFv4
Bob
Hi Bob,
thanks for suggestion. Any way to see this been implemented in future releases of Chronoforms V5? I think I can wait for it instead of making an hack now.
Thanks in advice.
thanks for suggestion. Any way to see this been implemented in future releases of Chronoforms V5? I think I can wait for it instead of making an hack now.
Thanks in advice.
Hi deltafidesign,
Sorry, I have no idea what Max has on his 'to-do' list.
Bob
Sorry, I have no idea what Max has on his 'to-do' list.
Bob
Hello GreyHead
I just tested your method to get Address IP and save it in DB but that don't work. All data are saved except "ip_address".
<?php
$form->data['ip_address'] = $_SERVER['REMOTE_ADDR'];
?>
I created the field "ip_address" in the DB and I put the PHP code in "Custom Code" in block "on submit" before the event "DB Save".
An idea ?
Thank you for advance.
++ Gilles
I just tested your method to get Address IP and save it in DB but that don't work. All data are saved except "ip_address".
<?php
$form->data['ip_address'] = $_SERVER['REMOTE_ADDR'];
?>
I created the field "ip_address" in the DB and I put the PHP code in "Custom Code" in block "on submit" before the event "DB Save".
An idea ?
Thank you for advance.
++ Gilles
Hi deltafidesign,
Please add a Debugger action to see if the IP address is being added to the $form->data array
Bob
Please add a Debugger action to see if the IP address is being added to the $form->data array
Bob
Thank you for your response GreyHead.
I put the debugger and the "ip_address" is there in the array but the save in the DB don't work.
All others field are filled in the DB.
++ Gilles
I put the debugger and the "ip_address" is there in the array but the save in the DB don't work.
All others field are filled in the DB.
++ Gilles
Hi deltafidesign,
OK, is the column name in the database exactly ip_address ?
Please copy and paste the debug output here.
Bob
OK, is the column name in the database exactly ip_address ?
Please copy and paste the debug output here.
Bob
Yes GreyHead
I verified and that's exactly the same name ...
++ Gilles
I verified and that's exactly the same name ...
++ Gilles
ChronoForm Version 5.0.0 (6 juin 2014)
Array
(
[chronoform] => contact
[event] => submit
[message] => TEST 5
[prenom] => John
[nom] => Doe
[telephone] =>
[email] => john.doe@company.com
[adresse] =>
[code-postal] => 5000
[localite] => Namur
[button10] => Submit
[contact] =>
[ip_address] => 91.183.9.72
)
Hi Gilles,
There should be more debugger code than that I think? Is there not any output from the DB Save action?
Bob
There should be more debugger code than that I think? Is there not any output from the DB Save action?
Bob
This full debugger response on the print screen in attachment.
Thank you.
Thank you.
Hello GreyHead
There's not more info debugger code than that. I've sent you in MP the URL to test.
Have you had the opportunity staring to ?
Thank you for your help.
++ Gilles
There's not more info debugger code than that. I've sent you in MP the URL to test.
Have you had the opportunity staring to ?
Thank you for your help.
++ Gilles
Hi Gilles,
I checked the form - it looks to me as though the DB Save isn't working at all. Is it enabled.
Bob
I checked the form - it looks to me as though the DB Save isn't working at all. Is it enabled.
Bob
I am having this same issue. I have a field in my database named "ipaddress". The database is not saving the value. Below is my debug log. This is only for CFV5 it works fine in V4. All fields are being saved except the ipaddress. I even tried to make a hidden field with the field name and id set to the db field name. The hidden field is being populated when I view the source but the field will not save to the db.
ipaddress varchar(255) utf8_general_ci
<input id="ipaddress" class="form-control A" type="hidden" value="10.5.0.8" name="ipaddress">
Array
(
[option] => com_chronoforms5
[chronoform] => NewStudentInquiryForm
[event] => submit
[new_student_name] => Adam
[new_student_email] => Test@test.com
[new_student_occupation] => I am a tester
[new_student_personalinfo] =>
[new_student_over18] => Yes
[new_student_age_under18] =>
[new_student_best_contact] => Email
[new_student_how_find] =>
[new_student_contact_reason] =>
[new_student_prior_exp_rdo] => No
[new_student_prior_exp_val] =>
[new_student_more_info] =>
[ipaddress] => 10.5.0.8
[button21] => Submit
[id] => 6
)
Array
(
[26] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `ptko3_chronoforms_data_NewStudentInquiryForm` (`new_student_name`, `new_student_email`, `new_student_occupation`, `new_student_personalinfo`, `new_student_over18`, `new_student_age_under18`, `new_student_best_contact`, `new_student_how_find`, `new_student_contact_reason`, `new_student_prior_exp_rdo`, `new_student_prior_exp_val`, `new_student_more_info`, `user_id`, `created`) values ('Adam', 'Test@test.com', 'I am a tester', '', 'Yes', '', 'Email', '', '', 'No', '', '', '0', '2014-07-16 21:36:09');
)
)
)
)
In v5 you should click the "Delete cache" button under the forms manager after any manual changes to the database tables.
Regards,
Max
Regards,
Max
This topic is locked and no more replies can be posted.
