This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 3
Add Session login id
Started 13 years ago by Lobbyof | 7 posts |
-
Hi,
Great product, setup a form in minutes!!
I have a two part process, a php script allows the user to login (unique login name).
I want to store the username they have used in the form (hidden field is fine) just for reporting purposes so I can see who generated the form data for each submission.The login id is stored globally, by a
$_SESSION['SESS_LOGIN'] = $member['login'];which is in the login exec php file.
Can that be entered into a form?
Posted 13 years ago # -
It is possible through some modification. Can you let me know the URL of your form?
You can send the URL via email if you don't want to post it here.Mail to: customer.service [at] appnitro.com
MachForm Founder
Posted 13 years ago # -
Response emailed
Posted 13 years ago # -
Thank you, what you provided worked perfectly:
Ok, first you will need to add a "Single Line Text" field into your form, which will be used as the hidden field.
Apply the CSS class "hidden" to hide the field.Then update your "includes/view-functions.php" file with the one I attached.
I've placed the code around line 57-61://start custom login session
if($element->form_id == 2 && $element->id == 14){
$element->default_value = $_SESSION['SESS_LOGIN'];
}
//end custom login sessionthe code assumed your hidden field is having element id = 14.
You might need to change this number with your own correct number (view the HTML source of your form to see the element id of your hidden field).Posted 12 years ago # -
I see V3.4 is out now, will the above mod still work or do you think it'll have unintended consequences?
I presume its just a matter of changing view-functions.php as before.
Posted 12 years ago # -
The code should be the same, but the location/line number of the code might change a bit.
MachForm Founder
Posted 12 years ago # -
Hi,
I've made the mods, and the field is stored in the db. However, afterwards if I view any the Entries in the table (through the machform panel), and then Edit one of the records, the Originator field is blank on the edit page.
Paddy
Posted 12 years ago #
Reply
You must log in to post.