PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Nope, Javascript is client-side and PHP is server-side. You might be able to make PHP script calls with Ajax but I'm not sure as I've never used Ajax.
Looking at your example code, I'm not entirely sure what you're trying to do, but if you had all that within a print function around all that, you could output PHP variables into your Javascript script if that's what you're asking about.
You can do it... ultimately you are just echoing the $search variable to the HTML output... Instead of using <?php echo $search;?> you could also use <?=$search?>. This is much better for maintenance and debugging.
sunilbhatia79 wrote:You can do it... ultimately you are just echoing the $search variable to the HTML output... Instead of using <?php echo $search;?> you could also use <?=$search?>. This is much better for maintenance and debugging.
Care to explain why? I've always found that using shortcuts in code makes them harder to maintain and debug.