title: load a form action result page into <div> without refreshing
body: <p>I would like to load the result <code>(add_cart.php?action=add&amp;id=".$item[$i]['id'].")."</code> of this select form in a div but still passing the variable to the <code>add_cart.php</code> page load the <code>add_cart.php?action=add&amp;id=".$item[$i]['id']."</code> page into a div without refreshing but having the page do the action.</p>
  
  <p>The code:</p>
  
  <pre><code>print("&lt;div id='add_cart'&gt;&lt;/div&gt;
      &lt;form action='/add_cart.php?action=add&amp;id=".$item[$i]['id']."' method='post'&gt;
          &lt;select name='id' class='select'&gt;
              &lt;option selected='selected' value='".$sku[$s]['id']."'&gt;".$sku[$s]['id']."&lt;/option&gt;
              &lt;option value='".$sku[$s]['id']."'&gt;".$sku[$s]['id']."&lt;/option&gt;
          &lt;/select&gt;
          &lt;input type='submit' class='add_cart' value='".$lang['add_cart']."'&gt;
      &lt;/form&gt;
  ");
  </code></pre>
  
  <p>the add_cart code:</p>
  
  <pre><code>    session_start();
      if(isset($_POST['id'])) {
  $id = $_POST['id'];
  }else{
  $id = $_GET['id'];
  }
  $id_user = $_GET['id_user'];
  
  
      $cart = $_SESSION['cart_order'];
      $action = $_GET['action'];
  
      switch ($action) {
  case 'add':
      if ($cart) {
          $cart .= ','.$id;
      } else {
          $cart = $id;
      }
      break;
  case 'delete':
      if ($cart) {
          $items = explode(',',$cart);
          $newcart = '';
          foreach ($items as $item) {
              if ($id != $item) {
                  if ($newcart != '') {
                      $newcart .= ','.$item;
                  } else {
                      $newcart = $item;
                  }
              }
          }
          $cart = $newcart;
      }
      break;
  case 'update':
  if ($cart) {
      $newcart = '';
      foreach ($_POST as $key=&gt;$value) {
          if (stristr($key,'qty')) {
              $id = str_replace('qty','',$key);
              $items = ($newcart != '') ? explode(',',$newcart) :        explode(',',$cart);
              $newcart = '';
              foreach ($items as $item) {
                  if ($id != $item) {
                      if ($newcart != '') {
                          $newcart .= ','.$item;
                      } else {
                          $newcart = $item;
                      }
                  }
              }
              for ($i=1;$i&lt;=$value;$i++) {
                  if ($newcart != '') {
                      $newcart .= ','.$id;
                  } else {
                      $newcart = $id;
                  }
              }
          }
      }
  }
  $cart = $newcart;
  break;
  </code></pre>
  
  <p>}</p>