The javascript cannot redirect when the subId value is a letter but if it is a number it works fine.
here's my code
if($sql_update==true){
echo "<script type='text/javascript'>
function alertAndRedirect(subId) {
alert('Updated');
window.location = '?tag=subject_entry&opr=upd&rs_id='+subId;
}
alertAndRedirect(".$_POST['sub_code_txt'].");
</script>";
}
the variable subId only accepts integer or number from the post method alertAndRedirect(".$_POST['sub_code_txt'].");. How can I let javascript accept the string id so that I can redirect?