• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet and PHP

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic