To clarify, the search function is really that of WordPress, so to accomplish this goal, as Danny said, you need to add the code to the functions.php in your child theme (if using one) or in the PageLines Customize plugin.
Here's some documentation about that:
You'll want to use the Action Map plugin (free in our Store) and pinpoint the search criteria you want. Once found, You can create a hook which includes the PHP snippet.
The reason your site breaks when just adding that code is that it is a PHP script, but so too is the functions.php. You have to end PHP processing before adding the new script. Once finished, you have to restart PHP.
This is generally done like this:
php?> (ends processing)
<php your code>
<?php (restarts PHP)
It's the only safe way to include a PHP process. There's a bit more to it, but between the documentation and the Action Map, you should be able to do it.
One easy way is to add the Hooker plugin, select the proper hook from the drop down list and add your PHP code in the edit field. This will ensure that the hook is structured correctly. All you do in that edit field is paste your code.