Angelo Zanetti wrote:

Hi,

is it possible to include a file from when a select's onChange is called ie:

<select name="prospects" onChange="include(editBottom.inc);">

if its possible what would be the best way to do this??

thanx


It is, but you have to reload the page and pass the filename as request variable:


<?php

$allowed_files = array('editBottom.inc' => 'Bottom', 'editTop.inc' => 'Top');

?>
<form action="script.php">
<select name="prospects" onChange="this.form.submit();">
<?php
foreach($allowed_files as $key => $name) echo "<option value=\"$key\">$name</option>\n";
?>
</select>


<input type="submit" value="&gt;&gt;"><!-- for nonjavascript brobsers -->
</form>
<?php
if(array_key_exists($_GET['prospects'], $allowed_files)) {
        include($_GET['prospects']);
}
?>

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to