Jump to content

gongpex

Members
  • Posts

    360
  • Joined

  • Last visited

Posts posted by gongpex

  1. Hello everyone

     

    Today I tried to create ajax shopping cart add use these code:

     

    JQuery :

    $(document).ready(function(){
    $("#fm").on('submit',function() {  // this code for form
    	var fsb = $(this).serialize();
          $.ajax({   
            type: "POST",
            url: "<?php echo base_url('index.php/product/add');?>", 
            data : fsb,
            dataType: "html",         
            success: function(response){                    
                $("#cart-info").html(response); 
            }
          });
       });  
    });
    

    this my php code on controller(using Code Igniter)

     function add() {
          $id = $this->input->post('product_code');
          $this->db->where('product_id',$id);
          $query = $this->db->get('product');
          $stock = $query->row()->stock;
    
          echo $stock;  // show stock of product
     }
    

    this on views :

    <div id="cart-info">This code supposed changed when user submit form on above</div>
    
    <form id="fm">
       <input type="text" name="product_code" value="<?php echo "A100";?>" /> <!-- this code for product id -->
       <button>TEST</button>
    </form> 
    
    
    

    My purpose is to show product stock on "cart-info" when user submitted this form.

     

    This code works properly on chrome and IE but didn't work on Opera and Firefox,

     

    Q : What mistake on my code?

     

    please help

     

    Thanks

  2. Hello everyone,

     

    Currently I looking freelance job for web developer,

     

    I had look on google and I only found 1 that's freelancer.com,

     

    but after saw the review, many people said this site are scam.

     

    Q : How to find trusted and reliable online freelance site for freelancer?

    please answer

     

    Thanks

  3. Hello everyone,

     

    I had build ajax live search using JQuery to display data from my database using PHP,

     

    It can show the suggestion, but I want to display it using either of effects like slideDown or Fade,

     

    I had tried it but it's didn't work, this my code :

    $(document).ready(function() {      $("#suggestion").on('keyup focus',function() {        var selTable = $(this).val(); // selected name from search box      $.ajax({            type: "GET",        url: "<?php echo base_url();?>/index.php/search/product/",         data : {'suggest':selTable},        dataType: "html",   //expect html to be returned                        success: function(response){                                $("#responsecontainer").html(response).slideDown("slow");         }      });   });}); 

    or

    $(document).ready(function() {      $("#suggestion").on('keyup focus',function() {        var selTable = $(this).val(); // selected name from search box      $.ajax({            type: "GET",        url: "<?php echo base_url();?>/index.php/search/product/",         data : {'suggest':selTable},        dataType: "html",   //expect html to be returned                        success: function(response){                                $("#responsecontainer").html(response).fadeOut("slow");         }      });   });}); 

    Q : What mistake on my code?

     

    please help me

     

    Thanks

  4. Hello,

     

    Q1 :That can be send SMS on USA only or all around of the world?

     

    Q2 : Can I use my own number on my mobile phone to send sms via web? so I can send sms either using mobile phone or my website

     

    please help

     

    Thanks

  5. Hello everyone,

     

    Today I read some article on google that we can send SMS to mobile phone using email for free,

     

    But I didn't found tutorial about it,

     

    A : Can somebody here tell to me tutorial about how to send SMS via email using PHP?

     

    please someone help me

     

    Thanks

  6. allright, my purpose is not looking driver for playstation joystick, but to make own playstation joystick driver,

     

    I think I must tell you something :

     

    a month ago I bought usb playstation joystick, when I bought it, the driver is available, but when I tried to install it on my windows 8 pc it blocked by windows defender because there is malware on that driver.

     

    That's why I think I need to learn how to make own driver.

     

    please help me

     

    Thanks :(

  7. Hello everyoneMaybe my question is not have correlation with web, but I really want to learn about how to make device driver.I have read some article that we can build device driver using java, but I didn't found tutorial about how to make device driverA : Can someone tell me where I can found tutorial how to make device driver using java?please someone help meI really appreciate your information.Thanks

    • Like 1
  8. Hello veryone,

     

    Today I tried to make validation to prevent automatic order if stock product on databse not enough to process,

     

    this is my code :

    $query = $this->db->query("select * from headerautoorder");		 		 $time = Date('Ymd');  		 $today = Date('d'); 		 $day= Date('D'); 		      	 if($query->num_rows > 0) { // core if		 		 $no = 0;		 foreach($query->result() as $rows) { // core foreach		   		    $idautoorder = $rows->idautoorder; 			$tgl_order = $rows->tgltransaksi;			$tglakhir = $rows->tglakhir; 			$tipe = $rows->tipe; 			$keterangan = $rows->keterangan; 			$total_payment = $rows->total; 			$idmember = $rows->idmember; 				//this is my question : is this code true? this to check if stock is enough or not for transaction				$cekdetail = $this->db->query("select * from detailautoorder where idautoorder='$idautoorder'");				$permintaan=array();				foreach($cekdetail->result() as $hdetail) {					$idbarang = $hdetail->idbarang;					$jbrg = $hdetail->jmlitem;  					$permintaan[$idbarang] = $jbrg; 						}								foreach($permintaan as $idbarang => $jbrg) {				    $q='select * from barang where status > 0 and idbarang='.$this->db->escape($idbarang);					$brgdata = $this->db->query($q)->row_array();					$stock = $brgdata['stock'];					if($stock < $jbrg) {					$flag = FALSE;					}							    } # end foreach 							   	# primary if #		            if($flag == TRUE) {                                 echo 'succesfull';                            } else {                              echo 'failed';                            } # end primary if  							   } # end if core   		       } # end core foreach

    I have 4 table on database :

     

    - headerautoorder

    - detailautoorder

    - order

    - detailorder

     

    My code located on login area , so after user succesfull login this code will be executed automatically,

    This code purpose to filter whether the stock of product is enough or not

     

    please help me this code is true or still has a mistake

    note : if you confuse I will give you screenshot of my database

     

    thanks

     

  9. Hello everyone,

     

    have simple codeigniter code :

    function example($id) {   if(empty($id)) {          redirect(base_url('index.php/example'));   } }

    this code $id is empty it will redirect automatically on page that determined.

     

    This work on localhost, but after I uploaded on hosting this code didn't work it will show :

    Missing argument 1 for Example::example()

    and

    Cannot modify header information - headers already sent by (output started at /srv/disk2/602761/www/example.com/system/core/Exceptions.php:189) 

    I had ask to my hosting and they answer to me this probably because they prohibits me to use .htaccess because my hosting is free.

     

    Q :Is that true?

     

    please answer

     

    Thanks

  10. Hello everyone

     

    usually on codeigniter to retrieve value we use:

    $this->session->userdata('sessionname');

    and value from this session can be displayed on class moreover on views for example :

      class example extends CI_Controller {    function __construct() {    }  function example() {       if($this->session->userdata == 0) {      echo 'ok';      } else {      echo 'no';       }   $data['value'] = this->session->userdata('sessionname');  }  }

    but how to get value from native session data generated by views ?

     

    for example :

     $qty = $_SESSION['cart'][$p_id]['quantity'];

    so that, on class it can be displayed like this :

     class example extends CI_Controller {    function __construct() {    }  function example() {       if($_SESSION['cart'][$p_id]['quantity'] == 0) {      echo 'ok';      } else {      echo 'no';       }   $data['value'] = $_SESSION['cart'][$p_id]['quantity'];  }  }

    I had try to retrieve / get value from $_SESSION[] on class but it didn't work.

     

    Q : What I must do so that I can retrieve value from $_SESSION[], so that I can insert them into database using function $this->db->insert('nameDB',$data);

     

    please help me

     

    Thanks

  11. Hello everyone,

     

    I have a code :

     

    index.php

    <html><head></head><body><form action="update.php" method="post">   <label>Name</label>  <input type="text" name="test"  />  <select name="activate">    <option value="on">ON</option>    <option value="off">OFF</option>  </select><button>Update</button></form></body></html>

    usually if we want to update we put this code :

     

    update.php

    <?php$test = $_POST['test'];$activate = $_POST['activate'];mysqli_query($connect,"update name_table set status='$activate' where name ='$test'")?>

    Q : how to set ajax so that user no need to press submit button, but only choose 'ON / OFF' on select option so the update script (on update.php) can be executed?

     

    please help me

     

    Thanks

  12. Hello thanks for answer

     

    but sorry I'm rather confuse with new code, I think I need to show all of my file :

     

    cart.php (past code before update)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Portofolio Book Store</title><?php include('template/css_style.php'); ?><?php include('template/javascript_library.php');?><script type="text/javascript">$(function() {           $.ajax({               type: 'GET',               url: '<?php echo base_url('index.php/user/ajax');?>',               data: {ScreenWidth: $(window).width()},              success: function(data) {               // alert(data);               $('#php_screen_width').html(data);             }           });        });</script></head><body>

    ajax.php

    <?php$jq_ajax_screen_width = $_GET['ScreenWidth'];if ($jq_ajax_screen_width > 960) {  echo 'ok' .$jq_ajax_screen_width ;} else {   echo 'no'.$jq_ajax_screen_width ;}?>

    on cart.php if I put code :

    <div id ='php_screen_width'></div>

    it will shown the result of ajax.php 'ok' if screen width greater than 960px and 'no' if otherwise.

     

    my expecation : I can get the value from jquery ($jq_ajax_screen_width) into cart.php so :

    if ($jq_ajax_screen_width > 960) {  echo 'ok' .$jq_ajax_screen_width ;} else {   echo 'no'.$jq_ajax_screen_width ;}

    or

    if ($jq_ajax_screen_width > 960) {  $value = 'ok';} else {  $value = 'no';}echo $value;

    so when I put echo $value like on above, I can get the result correctly.

     

    and finally for details so that I can make :

    <?phpif($value=='ok') {  echo 'this ok';}else{  echo 'this no';}?>

    on cart.php

     

    please help me

     

    Thank you

  13. Hello everyone,

     

    Guys I think I post wrong question, please see this code :

    using javascript / jquery we can get screen size var width = $(window).width(), height = $(window).height();if ((width <= 1023) && (height >= 768)) {document.write('responsive');} else {document.write('no');}

    and usually we give value on php variable like this :

    <?php$example = 'ok';echo $example;?>

    code on above will display 'ok',

    Q: how to pass value that generated from Jquery (whether 'responsive' or 'no') into php variable?

     

    so that :

    <?php$example = 'value from jquery code';?>

    when I put echo command , it will display value from jquery

     

    please help me

     

    Thanks

  14. Hello everyone,

     

    I think all of you know that to detect screen resolution we can't using pure php,

     

    I found tutorial on google but I'm still confuse to use them please see this code:

    <? php if ([SCREEN SIZE CODE FROM JQuery] > 960px) {echo 'OK';}ELSE{echo 'no';}?>

    for instance this filename is : tes.php.

     

    on that tutorial they only show this :

    if( $(window).width() > 960 ){  $.ajax({    url: 'js/nbw-parallax.js',    dataType: "script",    success: function() {        //success    }  });}

    Q : about that jquery code, what I must do? (should I put this code on tes.php or should I put this code on another file such test.html or etc?)

     

    note : my expectation only so that if I open tes.php from I can see the result 'ok' if the screen resolution is greather than 960px.

    And I got this tutorial from : http://stackoverflow.com/questions/15142902/php-echo-statement-if-screen-is-a-certain-size

     

    please someone help me

     

    Thanks

  15. Hello everyone,

     

    Long time no see. I hope all of you okay.

     

    Often I met shopping cart always use 'recalculate' button to update price from product.

     

    But I think I need to improve it,

     

    T : So, Can you tell me tutorial about auto calculate shopping cart using JQuery and ajax ?

     

    please help me

     

    Thanks

  16. Hello everyone,

     

    I think I need to ask about how to make responsive code for jquery/javascript,

     

    because sometimes I often found there is some jquery like slider or carousel not responsive.

     

    so I need to learn how to make responsive from jquery or javascript not from CSS.

     

    E : Can you teach me how to make responsive code?

     

    please help

     

    Thanks

  17. Hello,Thanks for reply before, but, can you give me some advice what I must do,so that, when I will show my website on my client all of my work will not lost, so that not cause embarassed on meplease helpthanks

  18. Hello everyone,

     

    I think I need to tell all of you about my case :

     

    * 2 month ago I visit my website, but it's displayed nothing, and then I check into my web hosting,

    after I check, all of my file lost and then I contact to my web hosting admin.

     

    * they said if I'm sure ever upload my file here, please change password and check you computer using anti malware and etc

     

    * I said : Am I hacked by cracker, they said to me if that's impossible

     

    Q : Is that true if my file lost because not hacked by someone?

     

    please help me

     

    Thanks

     

×
×
  • Create New...