.htaccess with Array parameters (checkbox) and three others. GET method










0














I have been tried to get this to work for a while now.



I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



I have successfully did it this one of my pages here:



RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);

for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);




submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);

);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>


This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



<form action="example.net/results" method="GET">


When this form is submitted, I get this...



https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


What I would LOVE to be able to do, is to route that above URL to...



https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


OR, removing the &cb%5B%5D=



Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










share|improve this question




























    0














    I have been tried to get this to work for a while now.



    I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



    I have successfully did it this one of my pages here:



    RewriteCond %REQUEST_FILENAME -s [OR]
    RewriteCond %REQUEST_FILENAME -l [OR]
    RewriteCond %REQUEST_FILENAME -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


    This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



    However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



    <script>
    $(document).on('change', 'select', function()
    var itemSpecifics = document.getElementById('itemSpecifics');
    var submitButton = document.getElementById('submitButton');
    var narrowHelper = document.getElementById('narrowHelper');
    narrowHelper.innerHTML = "select all of the filters you want to search by.";
    var loading = document.getElementById('loading');
    loading = loading.style.display = "block";
    document.getElementById("submitButton").style.display = "none";
    //$("#submitButton").empty();
    $("#itemSpecifics").empty();
    $.ajax(
    type : 'GET',
    url : 'refine_search.php',
    data: category: $(this).val(),
    cache: false,
    dataType : 'json',
    encode : true,
    traditional: true,
    success: function (response, status, xhr)
    console.log(response);

    for (var i = 0; i < response.length; i++)
    console.log(response[i].name);
    itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
    //console.log(response[i].value);
    for (var j = 0; j < response[i].value.length; j++)
    console.log("-- " + response[i].value[j].value);
    var checkbox = document.createElement('input');
    checkbox.type = "checkbox";
    checkbox.name = "cb";
    checkbox.value = response[i].name + "@" + response[i].value[j].value;
    checkbox.id = "checkboxid";
    var label = document.createElement('label')
    label.htmlFor = "id";
    label.id = "label";
    label.appendChild(document.createTextNode(response[i].value[j].value));
    itemSpecifics.appendChild(checkbox);
    itemSpecifics.innerHTML += " ";
    itemSpecifics.appendChild(label);
    itemSpecifics.innerHTML += "<br>";
    $("input[type='checkbox']").on('change', function()
    console.log($(this).val());
    );




    submitButton.innerHTML = "SUBMIT";
    document.getElementById("loading").style.display = "none";
    document.getElementById("submitButton").style.display = "block";
    ,
    error: function (xhr, status, error)
    console.log(error);

    );
    // if you want to do stuff based on the OPTION element:
    var opt = $(this).find('option:selected')[0];
    // use switch or if/else etc.
    );
    </script>


    This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



    <form action="example.net/results" method="GET">


    When this form is submitted, I get this...



    https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


    What I would LOVE to be able to do, is to route that above URL to...



    https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


    OR, removing the &cb%5B%5D=



    Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










    share|improve this question


























      0












      0








      0







      I have been tried to get this to work for a while now.



      I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



      I have successfully did it this one of my pages here:



      RewriteCond %REQUEST_FILENAME -s [OR]
      RewriteCond %REQUEST_FILENAME -l [OR]
      RewriteCond %REQUEST_FILENAME -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


      This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



      However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



      <script>
      $(document).on('change', 'select', function()
      var itemSpecifics = document.getElementById('itemSpecifics');
      var submitButton = document.getElementById('submitButton');
      var narrowHelper = document.getElementById('narrowHelper');
      narrowHelper.innerHTML = "select all of the filters you want to search by.";
      var loading = document.getElementById('loading');
      loading = loading.style.display = "block";
      document.getElementById("submitButton").style.display = "none";
      //$("#submitButton").empty();
      $("#itemSpecifics").empty();
      $.ajax(
      type : 'GET',
      url : 'refine_search.php',
      data: category: $(this).val(),
      cache: false,
      dataType : 'json',
      encode : true,
      traditional: true,
      success: function (response, status, xhr)
      console.log(response);

      for (var i = 0; i < response.length; i++)
      console.log(response[i].name);
      itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
      //console.log(response[i].value);
      for (var j = 0; j < response[i].value.length; j++)
      console.log("-- " + response[i].value[j].value);
      var checkbox = document.createElement('input');
      checkbox.type = "checkbox";
      checkbox.name = "cb";
      checkbox.value = response[i].name + "@" + response[i].value[j].value;
      checkbox.id = "checkboxid";
      var label = document.createElement('label')
      label.htmlFor = "id";
      label.id = "label";
      label.appendChild(document.createTextNode(response[i].value[j].value));
      itemSpecifics.appendChild(checkbox);
      itemSpecifics.innerHTML += " ";
      itemSpecifics.appendChild(label);
      itemSpecifics.innerHTML += "<br>";
      $("input[type='checkbox']").on('change', function()
      console.log($(this).val());
      );




      submitButton.innerHTML = "SUBMIT";
      document.getElementById("loading").style.display = "none";
      document.getElementById("submitButton").style.display = "block";
      ,
      error: function (xhr, status, error)
      console.log(error);

      );
      // if you want to do stuff based on the OPTION element:
      var opt = $(this).find('option:selected')[0];
      // use switch or if/else etc.
      );
      </script>


      This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



      <form action="example.net/results" method="GET">


      When this form is submitted, I get this...



      https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


      What I would LOVE to be able to do, is to route that above URL to...



      https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


      OR, removing the &cb%5B%5D=



      Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










      share|improve this question















      I have been tried to get this to work for a while now.



      I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



      I have successfully did it this one of my pages here:



      RewriteCond %REQUEST_FILENAME -s [OR]
      RewriteCond %REQUEST_FILENAME -l [OR]
      RewriteCond %REQUEST_FILENAME -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


      This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



      However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



      <script>
      $(document).on('change', 'select', function()
      var itemSpecifics = document.getElementById('itemSpecifics');
      var submitButton = document.getElementById('submitButton');
      var narrowHelper = document.getElementById('narrowHelper');
      narrowHelper.innerHTML = "select all of the filters you want to search by.";
      var loading = document.getElementById('loading');
      loading = loading.style.display = "block";
      document.getElementById("submitButton").style.display = "none";
      //$("#submitButton").empty();
      $("#itemSpecifics").empty();
      $.ajax(
      type : 'GET',
      url : 'refine_search.php',
      data: category: $(this).val(),
      cache: false,
      dataType : 'json',
      encode : true,
      traditional: true,
      success: function (response, status, xhr)
      console.log(response);

      for (var i = 0; i < response.length; i++)
      console.log(response[i].name);
      itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
      //console.log(response[i].value);
      for (var j = 0; j < response[i].value.length; j++)
      console.log("-- " + response[i].value[j].value);
      var checkbox = document.createElement('input');
      checkbox.type = "checkbox";
      checkbox.name = "cb";
      checkbox.value = response[i].name + "@" + response[i].value[j].value;
      checkbox.id = "checkboxid";
      var label = document.createElement('label')
      label.htmlFor = "id";
      label.id = "label";
      label.appendChild(document.createTextNode(response[i].value[j].value));
      itemSpecifics.appendChild(checkbox);
      itemSpecifics.innerHTML += " ";
      itemSpecifics.appendChild(label);
      itemSpecifics.innerHTML += "<br>";
      $("input[type='checkbox']").on('change', function()
      console.log($(this).val());
      );




      submitButton.innerHTML = "SUBMIT";
      document.getElementById("loading").style.display = "none";
      document.getElementById("submitButton").style.display = "block";
      ,
      error: function (xhr, status, error)
      console.log(error);

      );
      // if you want to do stuff based on the OPTION element:
      var opt = $(this).find('option:selected')[0];
      // use switch or if/else etc.
      );
      </script>


      This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



      <form action="example.net/results" method="GET">


      When this form is submitted, I get this...



      https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


      What I would LOVE to be able to do, is to route that above URL to...



      https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


      OR, removing the &cb%5B%5D=



      Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.







      php ajax .htaccess






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 '18 at 12:19









      lgwilliams

      503317




      503317










      asked Nov 10 '18 at 12:13









      soldforapp

      1,5551317




      1,5551317






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238831%2fhtaccess-with-array-parameters-checkbox-and-three-others-get-method%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238831%2fhtaccess-with-array-parameters-checkbox-and-three-others-get-method%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Edmonton

          Crossroads (UK TV series)