Jump to content

translate my code please; javascript to php


ldonop

Recommended Posts

translate my code please; javascript to php. very very very very thanks.



<form>
<input type="checkbox" name="myfilter" value="+abst">Amytag1
<input type="checkbox" name="myfilter" value="+mini">Amytag8
<input type="checkbox" name="myfilter" value="+popa">Amytag9
<input type="checkbox" name="myfilter" value="+impr">Amytag13
<input type="checkbox" name="myfilter" value="+green">Amytag15
<input type="checkbox" name="myfilter" value="+gh5">Amytag18
<input type="checkbox" name="myfilter" value="+gh4">Amytag19
<input type="checkbox" name="myfilter" value="+gh3">Amytag34
  <input id="search1" placeholder="Word Search..." value="">
  <input id="year1" placeholder="Year" value="">
  <input id="month1" placeholder="Month" value="">
  <input id="day1" placeholder="Day" value="">
  <input id="mymenu" value="">
</form>
<button onclick="myFunction()" class="Sbutton">search it</button>


<script>
function myFunction() {
  var myfilter = document.forms[0];
  var txt = "";
  var i;
  for (i = 0; i < myfilter.length; i++) {
    if (myfilter[i].checked) {
      txt = txt + myfilter[i].value;
    }
      var year = "&year=" + document.getElementById("year1").value;
      var month = "&month=" + document.getElementById("month1").value;
     var day = "&day=" + document.getElementById("day1").value;
     var search = "&s=" + document.getElementById("search1").value;
	  var tag = "/?tag=" + document.getElementById("mymenu").value;
  }
  var zzz = "http://test.com/category/art" + txt + tag + year + month + day + search;
 window.location.assign(zzz)

}
</script>

 

and please, not use this way:

  header("Location: {$target}");
  exit;

Because it doesn't work on my site (for some reason).

p.s: I have a lot of checkbox.

Edited by ldonop
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.