This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

HTTP web server

I am trying to create a dynamic web server, which has many select forms ranging from 10 to 120 depending on user input. Each select forms have 3 options. The user has to select the options for each select form and press submit which save all the data in the EEPROM. Now I want to prefill the select forms with the options the user entered next time he/she opens the webpage. I tried the following code- I

n script file t var prefill = document.getElementsByTagName("select");

t for(fc=0;fc<ctotal;fc++) //ctotal is the number of select forms generated

t { c d k prefill[fc].value="%s";

t }

in http_server_cgi

uint32_t netCGI_Script (const char *env, char *buf, uint32_t buflen, uint32_t *pcgi)

{ // TCP_INFO *tsoc; uint32_t len = 0;

if(c1>forms_t) //forms_t is the total number of select forms

{ c1=0; }

switch (env[0]){ // Analyze a 'c' script line starting position 2

case 'd': switch(env[2])

{ case 'e': break;

case 'k': len=sprintf(buf,&env[4],eep_read+c1); //eep_read is an array which has all the data entered by the user

c1++; break; }break; } return (len); } This is not working. Is there any way to make this work?

Parents
  • t var prefill = document.getElementsByTagName("select"); 
    t for(fc=0;fc<ctotal;fc++)  // ctotal is the toal number of select forms
    t {
    c d k prefill[fc].value="%s";
    t }
    t  }
     

    uint32_t netCGI_Script  (const char *env, char *buf, uint32_t buflen, uint32_t *pcgi) {
    //  TCP_INFO *tsoc;
      uint32_t len = 0;
    	if(c1>ctotal)
      {
    	c1=0;
    	}
    	c1++;
      switch (env[0]){
        // Analyze a 'c' script line starting position 2
    
    				case 'd':
    					switch(env[2]){
    						case 'e': break;
    						case 'k':  
    
    			len=sprintf(buf,&env[4],eep_read+c1);// eep_read contains all the selections by the user
    						
    						            
    						break;
    						case 'g': break;
    		}break;
    
     }
      return (len);
    }

    thanks..

Reply
  • t var prefill = document.getElementsByTagName("select"); 
    t for(fc=0;fc<ctotal;fc++)  // ctotal is the toal number of select forms
    t {
    c d k prefill[fc].value="%s";
    t }
    t  }
     

    uint32_t netCGI_Script  (const char *env, char *buf, uint32_t buflen, uint32_t *pcgi) {
    //  TCP_INFO *tsoc;
      uint32_t len = 0;
    	if(c1>ctotal)
      {
    	c1=0;
    	}
    	c1++;
      switch (env[0]){
        // Analyze a 'c' script line starting position 2
    
    				case 'd':
    					switch(env[2]){
    						case 'e': break;
    						case 'k':  
    
    			len=sprintf(buf,&env[4],eep_read+c1);// eep_read contains all the selections by the user
    						
    						            
    						break;
    						case 'g': break;
    		}break;
    
     }
      return (len);
    }

    thanks..

Children
No data