<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"
>
<html lang="en">
<head>
<title><!-- Insert your title here --></title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#from').keyup(function(event) {
<?php
$mysql_user="root";
$mysql_password="";
$mysql_database="database";
$mysql_host="localhost";
$koneksi_db = mysql_connect($mysql_host, $mysql_user, $mysql_password);
mysql_select_db($mysql_database, $koneksi_db);
$que = "SELECT * FROM `ms_item` WHERE kodeitem = 'B01'";
$q=mysql_query($que);
$rowC = mysql_fetch_array($q);
$test = $rowC['NameItem'];
?>
var test = "<?php echo $test; ?>";
$('#to').val(test);
});
});
</script>
</head>
<body>
<input type="text" id="from" />
<input type="text" id="to" />
</body>
</html>
this code run, but i need to pass javascript variable to php variable to execute query.
see this line:
$que = "SELECT * FROM `ms_item` WHERE kodeitem = 'B01'";
that 'B01' should be from textbox (id: from)
how can to pass/trick that variable?
thanks

New Topic/Question
Reply



MultiQuote




|