<script language="javascript" type="text/javascript">
function validate5(str)
{
var myvar = <?php echo json_encode($code);?>
if (str.valueOf()===myvar.valueOf())
{
<?php include_once("view/ok.php");
$this->model->insertCustomer(); ?>
return true;
}
else{
alert("Wrong Key ...Try Again");
return false;
}
}
</script>
</head>
<body>
<form >
<h3> Insert Code: </h3> <input type="text" id="code" />
<button type="button" onclick="return validate5(code)">Confirm</button>
</form>
</body>
I've declared the $code correctly i just want to redirect the user to ok.php if the text user entered matches with the $code is code is correct or stay on same page. is it possible to it the way i'm trying to do? if not please suggest some different way