mhamilton Posted March 22, 2018 Share Posted March 22, 2018 I am trying to pass a Frog User field on to a PHP page to allow data to come up without user intervention. Is there a way to submit this data if they hit a button to access the page by which the button acts as a submit passing the information from that user on to the PHP page? Thanks! Link to comment Share on other sites More sharing options...
Graham Quince Posted March 23, 2018 Share Posted March 23, 2018 Hi @mhamilton This tutorial: https://www.frogeducation.com/community/tutorials/html-tutorials/html-intro goes into some detail, but shows you how to use this code: var user = FrogOS.getUser(); To get the logged in user's details. With this, it should be straight-forward to add it to a button which could either use a URL with the variable attached or an html form to push the details to a php page <a href="yourpage.php?user=myvar">click</a> or <form action="yourpage.php" method="push"> user details: <input type="text" name="userdetails" value="myvar"><br> <input type="submit" value="Submit"> </form> You'd need to add the myvar bit using Javascript: <div class="mybutton"></div> <script> var user = FrogOS.getUser().username; this.element.find('.mybutton').html( '<a href="yourpage.php?user='+user+'&" target="_blank">click</a>' ) </script> Link to comment Share on other sites More sharing options...
mhamilton Posted March 23, 2018 Author Share Posted March 23, 2018 This is awesome Graham. You are always a help. Is there a list of fields you can pull from FrogLearn var user = FrogOS.getUser(); Will .getuser pull Username ? Much appreciated. Link to comment Share on other sites More sharing options...
Graham Quince Posted March 23, 2018 Share Posted March 23, 2018 Try: var username = FrogOS.getUser().username; There isn't a list to hand, but if you're familiar with the browser's console log, then: var user = FrogOS.getUser(); console.log(user); Will show you all the information this API returns. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now