PDA

View Full Version : How to embed PHP into Javascript?


chxxqiqi
11-11-2007, 09:15 PM
is it possible?


<SCRIPT LANGUAGE="Javascript">
document.location = "product.php?search=<?php echo $search;?>"
</SCRIPT>

FoxLeader
11-12-2007, 03:06 PM
Mmmm... I think. Not sure, but I'd say... just try it !?!!

srussell
11-13-2007, 08:41 AM
Make sure to retrieve your $seach variable from your search field (?) prior to calling that function. Then you should be good to go...

<?php
$search = $_POST['searchfield'];
?>

or

<?php
$search = $_GET['searchfield'];
?>