This question already has an answer here:
I`m trying to pass a string value to a JavaScript parameter. this is my html code
<input type="submit" value="Edit" onclick="edit(<?php echo $key; ?> );" name="<?php echo $key; ?>" >
this is my JavaScript function
<script type="text/javascript">
function edit(id){
window.location.href="http://localhost/koko/edit-post.php?id="+id;
}
</script>
But this didn't work for me. How I solve this problem?
</div>