Running a javascript function that is in an external .js file from within the script? (attached by src=) Using PHP
<p>I'm using PHP code to generate the  tag in the  tags of my webpage.</p>

<p>I'm using PHP so that if a particular GET variable has been set (in this case, 'savedsearch') it runs a functions from the external javascript file I'm attaching to the web page.</p>

<p>Here's the code I'm using:</p>

<pre><code>&lt;?php
//check if a saved search has been used
if (isset($_GET["savedsearch"])) {
    $savedsearch=$_GET["savedsearch"];
    echo "&lt;script type='text/javascript' src='search.js'&gt;
    window.onload=sendsearch($savedsearch);
    &lt;/script&gt;";
}
else {
    echo "&lt;script type='text/javascript' src='search.js'&gt;&lt;/script&gt;";
}
?&gt;
</code></pre>

<p>This isn't working (doesn't run the function if the savedsearch is set)... is running a functions like this possible?</p>

<p>Is there any other way I can do this without having any javascript or PHP in the body of my page?</p>

<p>Help appreciated and thanks in advance.</p>
