It's the same as how you have done it in your function with $location
:
redirect_to("thread.php?id=$thread_page");
You can wrap in curly braces for consistency if you like:
redirect_to("thread.php?id={$thread_page}");
Also, this looks like $thread_page
might be an integer, but if you are passing any other types of data it is best to use urlencode()
.
redirect_to("thread.php?id=" . urlencode($thread_page));