![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Java and Web Pages
I've got this java program which needs to be able to enter data in a textbox on a web page. Shown below,
![]() Is there a way that I'd be able to enter data in the textBox (marked 'something') and then hit the "Submit Query" button without the user seeing me do this? I'm doing this because on that web page a PHP program will run and calculate a highscores list for my game. Does Java have this sort of capability?
__________________
Death smiles at us all. All a man can do is smile back. Last edited by Eric the Red; Jul 4th, 2006 at 9:38 AM. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
Learn the name of the fucking programming language you're using before you ask questions.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#3 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Quote:
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
|
#4 |
|
Expert Programmer
|
I think uman is refering to the fact that you may be confusing Java and JavaScript, two completely different languages.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#5 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Quote:
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
|
#6 |
|
Programmer
|
If your using a java applet then surely this would not be difficult. You would have the text box and button in the applet, then you can do what ever you want with them.
But if you want php and java to send data to each other then i think its probably impossible. But i could be wrong. I think you should go find out what java applets can really do, and then find out that there are easier ways. I dont quite understand why you want to do what you are doing? Maybe if you explain with some code and more detail people wount swear at you.
__________________
Bite My Shiny Metal Ass |
|
|
|
|
|
#7 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
Sorry, I assumed you were confusing Java with JavaScript like countless retards who come in here. My apologies.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#8 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Not a problem.
Here's the html code for the page: <html> <body> <form action ="action.php" method="post"> <p>Your name: <input type="text" name="strname"/></p> <input type="submit"/> </body> </html> Here is action.php called by the main page (which is irrelevant to the java program) but you asked for it here it is. html> <body> <?php $strname=$_POST['strname']; print "you typed:$strname"; ?> </body> </html>
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#9 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
You want to take a look at how HTML forms work. When you hit the submit button the information in the textbox is packed into a url and sent to the webserver by your web browser. All you have to do is make that URL programatically instead of having the web browser generate it.
I am not sure but I think the URL looks something like below http://www.mywebpage.com/mypage?myTextField=10 Edit, I saw your new post: What you have to do is submit an html POST request and I believe the url should be: http://www.thewebpage/page?strname=198 EDIT: Updated the the last edit for clarity. |
|
|
|
|
|
#10 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Thanks Game Ender. I'll try it out.
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|