Jump to content

tobeyt23

Members
  • Posts

    259
  • Joined

  • Last visited

Posts posted by tobeyt23

  1. here is my update code:

     

    var summary= 
    {
    		load: function(id)
    		{
    			if(php.smart_empty(id))
    				return false;
    			utils.loading_icon(true);
    
    			ajax.get('/reports/leads_by_month?id='+id,'',false,"summary.json2html(r,'leads_by_month_data');");
    		},
    
    		json2html: function(obj,section) 
    		{
      				var html = '<ul>';
      				for(var key in obj)
      				{
        				html += '<li>';
        				if(obj.constructor != Array)
         					 html += '<b>'+key+':</b> ';
        				if(typeof obj[key] == 'object')
        				{
          					html += summary.json2html(obj[key],section);
        				}
        				else
          					html += obj[key];
       					html += '</li>';
    			}
      				html += '</ul>';
      				d = document.getElementById(section);
    			d.innerHTML=''+html+'';		
      				utils.remove_loading_icon(true);
    		}
    }; //end of class
    
    

     

    this is what i now get:

    Leads by Month

     

        * May 2008: undefined

        * Group_Total: undefined

    think i am overwriting them?

     

     

  2. I am trying to output my JSON array to the screen but am having a horrible time doing so. Here is my JSON array, how can I send this to the browser in a readable format?

     

    {"May 2008":{"New":{"Total":"163","Customer_List":["94262","94612","95002","95382","93912","94292","94662"
    
    ,"95032","95602","93622","93942","94332","95062","93652","93972","94372","94732","95092","95662","93682"
    
    ,"94012","94402","94762","76285","93712","94042","94432","95172","93742","94082","94462","94832","95212"
    
    ,"94112","94492","94872","95242","95432","93802","94172","94532","94912","76025","95472","93832","94202"
    
    ,"94562","95312","95512","93862","94232","94592","95352","95552","93892","94272","94622","76115","95582"
    
    ,"93922","94302","94672","95042","95612","93632","93952","94342","94712","95072","95642","93662","93982"
    
    ,"94382","94742","95672","93692","94412","94782","95152","95692","93722","94062","94442","94812","95182"
    
    ,"93752","94092","94472","94842","95222","75975","95412","93782","94502","94882","95252","95442","93812"
    
    ,"94182","94542","94922","76035","95492","93842","94212","94572","95322","93872","94242","94602","94992"
    
    ,"93902","94282","94642","95022","95592","93932","94312","94692","95052","75835","95622","93642","93962"
    
    ,"94352","94722","95082","95652","93672","93992","94392","94752","95122","76275","93702","94422","94792"
    
    ,"95162","93732","94072","94452","94822","95202","95392","93762","94102","94482","94862","93792","94162"
    
    ,"94512","94902","95262","95462","94552","95302","95502","93852","94222","94582","94972","95342","95542"
    
    ]},"Used":{"Total":"69","Customer_List":["93882","76105","95572","75815","76135","94702","75845","76165"
    
    ,"95632","75875","76195","95142","75905","76225","94802","75935","76255","75965","95402","93772","75995"
    
    ,"95272","94942","76055","94982","76085","95012","75795","75825","76145","75855","76175","95102","75885"
    
    ,"76205","94022","75915","76235","75945","76265","94142","76005","95292","94952","76065","95522","95362"
    
    ,"76095","95562","75805","76125","76155","75865","76185","75895","76215","94032","75925","76245","75955"
    
    ,"95232","75985","95422","76015","93822","94192","94932","76045","76075"]},"Group_Total":{"Total":"232"
    
    ,"Customer_List":["94262","94612","95002","95382","93912","94292","94662","95032","95602","93622","93942"
    
    ,"94332","95062","93652","93972","94372","94732","95092","95662","93682","94012","94402","94762","76285"
    
    ,"93712","94042","94432","95172","93742","94082","94462","94832","95212","94112","94492","94872","95242"
    
    ,"95432","93802","94172","94532","94912","76025","95472","93832","94202","94562","95312","95512","93862"
    
    ,"94232","94592","95352","95552","93892","94272","94622","76115","95582","93922","94302","94672","95042"
    
    ,"95612","93632","93952","94342","94712","95072","95642","93662","93982","94382","94742","95672","93692"
    
    ,"94412","94782","95152","95692","93722","94062","94442","94812","95182","93752","94092","94472","94842"
    
    ,"95222","75975","95412","93782","94502","94882","95252","95442","93812","94182","94542","94922","76035"
    
    ,"95492","93842","94212","94572","95322","93872","94242","94602","94992","93902","94282","94642","95022"
    
    ,"95592","93932","94312","94692","95052","75835","95622","93642","93962","94352","94722","95082","95652"
    
    ,"93672","93992","94392","94752","95122","76275","93702","94422","94792","95162","93732","94072","94452"
    
    ,"94822","95202","95392","93762","94102","94482","94862","93792","94162","94512","94902","95262","95462"
    
    ,"94552","95302","95502","93852","94222","94582","94972","95342","95542","93882","76105","95572","75815"
    
    ,"76135","94702","75845","76165","95632","75875","76195","95142","75905","76225","94802","75935","76255"
    
    ,"75965","95402","93772","75995","95272","94942","76055","94982","76085","95012","75795","75825","76145"
    
    ,"75855","76175","95102","75885","76205","94022","75915","76235","75945","76265","94142","76005","95292"
    
    ,"94952","76065","95522","95362","76095","95562","75805","76125","76155","75865","76185","75895","76215"
    
    ,"94032","75925","76245","75955","95232","75985","95422","76015","93822","94192","94932","76045","76075"
    
    ]}},"Group_Total":{"Group_Total":{"Total":"232","Customer_List":["94262","94612","95002","95382","93912"
    
    ,"94292","94662","95032","95602","93622","93942","94332","95062","93652","93972","94372","94732","95092"
    
    ,"95662","93682","94012","94402","94762","76285","93712","94042","94432","95172","93742","94082","94462"
    
    ,"94832","95212","94112","94492","94872","95242","95432","93802","94172","94532","94912","76025","95472"
    
    ,"93832","94202","94562","95312","95512","93862","94232","94592","95352","95552","93892","94272","94622"
    
    ,"76115","95582","93922","94302","94672","95042","95612","93632","93952","94342","94712","95072","95642"
    
    ,"93662","93982","94382","94742","95672","93692","94412","94782","95152","95692","93722","94062","94442"
    
    ,"94812","95182","93752","94092","94472","94842","95222","75975","95412","93782","94502","94882","95252"
    
    ,"95442","93812","94182","94542","94922","76035","95492","93842","94212","94572","95322","93872","94242"
    
    ,"94602","94992","93902","94282","94642","95022","95592","93932","94312","94692","95052","75835","95622"
    
    ,"93642","93962","94352","94722","95082","95652","93672","93992","94392","94752","95122","76275","93702"
    
    ,"94422","94792","95162","93732","94072","94452","94822","95202","95392","93762","94102","94482","94862"
    
    ,"93792","94162","94512","94902","95262","95462","94552","95302","95502","93852","94222","94582","94972"
    
    ,"95342","95542","93882","76105","95572","75815","76135","94702","75845","76165","95632","75875","76195"
    
    ,"95142","75905","76225","94802","75935","76255","75965","95402","93772","75995","95272","94942","76055"
    
    ,"94982","76085","95012","75795","75825","76145","75855","76175","95102","75885","76205","94022","75915"
    
    ,"76235","75945","76265","94142","76005","95292","94952","76065","95522","95362","76095","95562","75805"
    
    ,"76125","76155","75865","76185","75895","76215","94032","75925","76245","75955","95232","75985","95422"
    
    ,"76015","93822","94192","94932","76045","76075"]}}}
    

     

    Here is the JS:

    var summary= 
    {
    		load: function(id)
    		{
    			if(php.smart_empty(id))
    				return false;
    			utils.loading_icon(true);
    
    			ajax.get('/reports/leads_by_month?id='+id,'',false,"summary.display(r,'leads_by_month');");
    			ajax.get('/reports/leads_by_customer_type?id='+id,'',false,"summary.display(r,'leads_by_customer');utils.remove_loading_icon(true);");
    		},
    
    		display: function(obj,section)
    		{
    			d = document.getElementById(section);
    
    			var s=new Array();
    			for(var key in obj)
    				s[s.length]=''+key+':'+obj[key];
    
    			if(s.length>0)
    			{
    				d.innerHTML=''+s.join(', ')+'';
    			}
    		}
    }; //end of class
    

     

    this is what i am getting:

    May 2008:[object Object], Group_Total:[object Object]

    Internet:[object Object], Phone-Up:[object Object], Previous Customer:[object Object], Walk-In:[object Object], Group_Total:[object Object]

  3. What does anyone recommend as a identifier for an end users other than the IP address? Working on a media rich site that will allow uploading and want to tag the uploads with this as a trace back.

  4. This seems to work:

     

    <?php
    $exf1 = 1;
    $exf2 = 0;
    $exf3 = 1;
    $exf4 = 0;
    $exf5 = 0;
    $exf6 = 1;
    
    $ename1 = "Test 1";
    $ename2 = "Test 2";
    $ename3 = "Test 3";
    $ename4 = "Test 4";
    $ename5 = "Test 5";
    $ename6 = "Test 6";
    
    $etype1 = "";
    $etype2 = "";
    $etype3 = "";
    $etype4 = "";
    $etype5 = "";
    $etype6 = "";
    
    $edata1 = "";
    $edata2 = "";
    $edata3 = "";
    $edata4 = "";
    $edata5 = "";
    $edata6 = "";
    
    
    $extras = array($exf1.":".$ename1.":".$etype1.":".$edata1, $exf2.":".$ename2.":".$etype2.":".$edata2, $exf3.":".$ename3.":".$etype3.":".$edata3, $exf4.":".$ename4.":".$etype4.":".$edata4, $exf5.":".$ename5.":".$etype5.":".$edata5, $exf6.":".$ename6.":".$etype6.":".$edata6);
    
    $t = 1;
    foreach ($extras as $extra) 
    {
    $setting = explode(':', $extra);
    if ($setting[0] == 1)
    {
    	echo "Extra field ".$t." => ".$setting[1]."<br><br>\n";
    }
    $t++;
    }
    ?>
    

  5. Need to check a group of form inputs and want to run them in a group instead of separate statements. This is what i have so far and no luck any suggestions. I just put the form fields as variables in these to test and this is a far as I got before I realized this may not be the best way. Any suggestions?

     

    Thanks

     

    <?php
    
    $exf1 = 1;
    $exf2 = 0;
    $exf3 = 1;
    $exf4 = 0;
    $exf5 = 0;
    $exf6 = 1;
    
    $ename1 = "Test";
    $ename2 = "";
    $ename3 = "";
    $ename4 = "";
    $ename5 = "";
    $ename6 = "";
    
    $etype1 = "";
    $etype2 = "";
    $etype3 = "";
    $etype4 = "";
    $etype5 = "";
    $etype6 = "";
    
    $edata1 = "";
    $edata2 = "";
    $edata3 = "";
    $edata4 = "";
    $edata5 = "";
    $edata6 = "";
    
    
    $extraFields = array($exf1, $exf2, $exf3, $exf4, $exf5, $exf6);
    
    $t = 1;
    foreach ($extraFields as $field) 
    {
    if ($field == 1)
    {	
    	echo $ename[$t];
    }
    $t++;
    }
    
    ?>
    

  6. I am taken an article from one MySQL DB table into another. The current records have \r\n in it, once I insert into in table I am losing them. How can I keep from losing them this is what i am current doing on them:

     

    addslashes(htmlspecialchars($article))
    

  7. I did this and it seems to work, does anyone see something wrong with it?

    function radioEducationHasValue()
    {
    var found = false;
    
    els = document.getElementsByName('hs_grade');
    for(j=0;test = els[j];j++)
    {
    	if( test.checked )
    	{
    		found = true;
    	}
    }
    
    els = document.getElementsByName('c_grade');
    for(j=0;test = els[j];j++)
    {
    	if( test.checked )
    	{
    		found = true;	
    	}
    }
    
    els = document.getElementsByName('post_grad');
    for(j=0;test = els[j];j++)
    {
    	if( test.checked )
    	{
    		found = true;	
    	}
    }
    
    if( !found )
    {
    	alert('Highest level compeleted must have one selected'); 
    
    	return false;
    }
    return true;
    }
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.