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!
Joined: Mar 22, 2005
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.
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!
Joined: Mar 29, 2009
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)?
Joined: Mar 24, 2009
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!