Hi there i currently have a PHP code where i need to pass the $value into the onclick function in order to call the javascript function to refresh my page. But if i pass a string value something like this "Cat 2" into the $value, i tried to inspect the javascript console on the $value it show me like this
<a href="#" onclick="filterRules('Cat" 2',2)="">2</a>
Where is automatically split my string value, what is suppose to have is something like this
2
Here is my example code for the link:
for($i=1;$i<=$total;$i++)
{
if($i==$id) { $link = $link. "<li class='current'>".$i."</li>"; }
else { $link = $link. "<li><a href='#' onclick = filterRules('".$value."',$i)>$i</a></li>"; }
}
Is there any single quote or double quote i place wrongly? Please point it out for me thanks.
EDITED: the $value is pass from user input where it will be "Cat 2" , not "Cat" "2" like what John had mark my question as duplicated. Thanks