Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet and PHP

 
Lee Stee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question about java Applets and PHP.

I have an applet written and deployed that collects information from the user. I need to export that information (19 numeric fields) to a PHP page that processes it. I have tested the PHP page and it works well with a standard HTML POST form. The java applet however, will not complete the process with the PHP form. I pasted the code below.



I found this code online and I think I'm getting closer, but nothing is happening. Does anyone know what is going on here?

Thanks, I really appreciate it!

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Does "nothing is happening" mean that the request doesn't reach the server?

The string-to-byte-to-string conversion looks suspect. What's more, the parameters should be URL-encoded, unless you can be certain that that's not needed. Here's an example of a POST using the URLConnection class.
 
Lee Stee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. I actually found my error was in the PHP file. The PHP file always checked to see if SUBMIT was set because I always test PHP though simple HTML forms that use submit. So, it wouldn't check anything since $_POST('Submit') was never set. Below is the final code I ended up using. I post this just in case anyone doing searching the web comes across this.

Thank you again for your help.



And the PHP file is shown below. It insert the values into a database recieved from the applet. All this code was simplified since it used to use over 100 variables to input. However, for the sake of anyone who is searching for ideas and possible solutions, this is much easier to look at and try out!

 
Alexis Michael
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's the speed of this operation compared to having the applet connecting directly to the database through JDBC ( not having in mind the security restrictions imposed on the applet)?
 
Lee Stee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The direct connection to the database is probably a bit faster, but nothing noticable from my end. My issue was that I couldn't direclty use JDBC because the host didn't allow it on their website. I think the streaming connection to the database would be more secure too. But like all software, you have to work with you got!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic