javascript with php..
Posted: Thu Mar 09, 2006 1:43 pm
Dont know why but this isnt working.
I dont see the input boxes at all when loading script.
I dont see the input boxes at all when loading script.
Code: Select all
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/Classes/mysql_class.php");
$dbc = new database( );
$dbc->connect() or die( $dbc->getError() );
function search($val) {
global $dbc;
$result = $dbc->select("stock",array("pid"=>$val)) or die( $dbc->getError() );
foreach ($result as $row) {
$val = $row->omschrijving;
}
return $val;
}
?>
</head>
<body>
<?php
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function copyValue(the_value){\n";
echo " document.getElementsByName(\"output\")[0].value = ".search("the_value");
echo "}";
echo "</script>";
?>
<input type="text" name="input" onChange="copyValue(this.value)">
<input type="text" name="output">