Jump to content

Post to PHP


mhamilton

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...