wannabe_god Posted June 6, 2006 Share Posted June 6, 2006 can i sent variables/other info from java to php?If yes: howI just want to send the score of the player in a java game (made by me of course) to a php page (coocies?) Link to comment Share on other sites More sharing options...
Jack McKalling Posted June 6, 2006 Share Posted June 6, 2006 You probably mean JavaScript. Java is quite different from JavaScript, while Java is not a programming language for the internet at all, and JavaScript is :)Yes javascript can pass variables to PHP, and visa versa. You can do so by posting form data to a php file or requesting a php file via GET method (passing variables via the link). There is no other way other than redirecting because php is server-side, and javascript client-side. Javascript can load the php document in a (i)frame, new window, or just in the same window. See how the posting form works:http://www.w3schools.com/tags/tag_form.aspAnd see how you can process its data with php:http://www.w3schools.com/php/php_forms.asp Link to comment Share on other sites More sharing options...
wannabe_god Posted June 6, 2006 Author Share Posted June 6, 2006 no, no, i meant java (that one, from sun ).<applet sh t></applet>, you know.But Is there a way to connect from java to php? just scores, so only one variable is required, and only once, so maybe I could put it into a database and remove it immedeatly...? Link to comment Share on other sites More sharing options...
aleksanteri Posted June 6, 2006 Share Posted June 6, 2006 You probably mean JavaScript. Java is quite different from JavaScript, while Java is not a programming language for the internet at all, and JavaScript is <{POST_SNAPBACK}> Java can be used in internet, in the applet form. Java can be run by any major browser I know (IE, FireFox, Opera).can i sent variables/other info from java to php?If yes: howI just want to send the score of the player in a java game (made by me of course) to a php page (coocies?)<{POST_SNAPBACK}> I do quess Java can handle cookies. How, that I don't know (I'm not a Java-master-expert though! )Check this out BTW. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 6, 2006 Share Posted June 6, 2006 You can probably either use Java to create a cookie (if possible), or to load a web page. All it needs to do is send a request. If you can send a request, you can do something like this: http://www.mysite.com/process.php?user=use...8&pwnd=trueThen have your process page do your database work. But Java can also connect to a database. Or you could also use Java Server Pages. Link to comment Share on other sites More sharing options...
wannabe_god Posted June 6, 2006 Author Share Posted June 6, 2006 @justsomeguy hey that's a nice idea... just "sitename"+"php variable"+scorevariableall I need now is better learning java 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