Can someone guide me on how to implement the following code snippet in order to redirect the page using window.location.href if the input contains an item from a JavaScript array? Here is the current code I have:
var myArray = ["1", "2", "3"];
function validateForm() {
var inputValue = document.forms["myForm"]["value"].value;
if (inputValue != "59864") {
alert("Input doesn't contain the desired value");
return false;
}
var inputValue = document.forms["myForm"]["value"].value;
if (inputValue == "59864") {
window.location.href = "index.php";
return false;
}
}