PHP file to get username
I have created a php file to grab the username when someone logs onto my site - LogIn.php.
<?php $u = new User(); $username = $u->getUserName(); ?>
I have set this up so that I can grab the username for any third party forms that are submitted on the site. If my understanding is correct I can input code into the external form to grab the username like so: (on lines 3 & 4 of code) [=<?php echo $username; ?>]
Am I missing something very fundamental here in order to get the username on the form as it is still not appearing? Do I need to add a get or post parameter to this in order for it to work? Should this LogIn.php be included in a PHP file already in use?
Help much appreciated.
1) Where are you currently integrating your LogIn.php page? Is it 'included' somewhere in the login process or are you hoping concrete5 will somehow just know you want this script to run.
2) Are you sure the jotform form is capable of reading the query string and injecting the username parameter into the form?
1. I was onto Jotform and they advised that I create a php file with this code and then insert code in the form to grab from it anywhere in the website. The LogIn.php file is not integrated with anything.
2. Yes. The code I used above is what they provided me. They were speaking about get and post parameters.
I realise I am missing a step somewhere along the way and I am guessing it is at the log in stage. I could be missing the point altogether too which is probably more likely.