i have the multiple chioce..

this is the source code

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
/**
* @author user
*/
public class listphp extends MIDlet implements CommandListener{
Command exitCommand = new Command("Exit", Command.EXIT, 2);
Command nextCommand = new Command("Next", Command.OK, 2);
    Display display;
    Form f1, f2;
    String pesan;
   private List pilihan;
    String [] menuitem;
   
     public void startApp() {
        f1 = new Form ("Koneksi Server");
        f1.append("Latihan untuk koneksi server");
        f1.addCommand(exitCommand);
        f1.addCommand(nextCommand);
        f1.setCommandListener(this);
        Display.getDisplay(this).setCurrent(f1);
   
      }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable s){
    String lbl=c.getLabel();
    if (lbl == "Exit"){
    notifyDestroyed();
    }
    else if (lbl == "Next"){
    doDownload();
    }
    }

    private String[] split(String original, String separator) {
        Vector nodes = new Vector();
        // Parse nodes into vector
        int index = original.indexOf(separator);
        while (index >= 0) {
            nodes.addElement(original.substring(0, index));
            original = original.substring(index + separator.length());
            index = original.indexOf(separator);
        }
        // Get the last node
        nodes.addElement(original);
        // Create splitted string array
        String[] result = new String[nodes.size()];
        if (nodes.size() > 0) {
            for (int loop = 0; loop < nodes.size(); loop++) {
                result[loop] = (String) nodes.elementAt(loop);
            }
        }
        return result;
    }

private void doDownload(){
f2 = new Form ("coba");
        pesan="";
   String URLsite = "http://localhost/siakad/test.php?";
     HttpConnection con = null;
   InputStream in = null;
   StringBuffer data = new StringBuffer();
   try{
   con = (HttpConnection)Connector.open(URLsite);
   in = con.openInputStream();

   int ch;
   while((ch = in.read()) !=-1){
   data.append((char)ch);
   }
   pesan = data.toString(); //data from server

menuitem = split(pesan, "|"); //create array from data server
ChoiceGroup cg= new ChoiceGroup ("PILIH",Choice.MULTIPLE, menuitem, null); //data server input into Choice group

f2.append(cg);
f2.addCommand(exitCommand);
f2.addCommand(nextCommand);
Display.getDisplay(this).setCurrent(f2);
}
   catch(IOException e){}
   
}
}

how to save the choice into database???

In similar way like you get data from server.
1. Open connection
2. Set request method to POST
3. Set request property to "Content-Type" and "application/x-www-form-urlencoded"
4. Send you data over to server
5. Server does database data entry and return OK for success or some custom message

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.