putting javascript variables into php file
Posted: Wed Jun 26, 2002 3:07 pm
Sorry if this has been answered before, I didn't see it when I searched the archives.
I have a javascript variable that I need to pass into a PHP block:
<script language="JavaScript">
<!-- Begin
function checkRadios() {
storeNum = document.storeSelector.storeRadio.value;
<?php
$storesVisited = fopen("beenthere_$NetID.txt" , "a+");//open file for
$storeNum = storeNum; //set PHP variable to JS variable
echo "alert($storeNum);";
fputs($storesVisited , $storeNum); //write variable to file
fclose($storesVisited); //close file
echo "alert($storeNum);";
?>
return true;
}
// End -->
</script>
The alerts both work as expected and output the contents of the JS variable (e.g. "Store1").
When viewing the text file however it has the variable name "storeNum", not the contents of the variable.
Help!?
PLease respond soonest as this is the last hangup to complete a project.
TIA,
Bryan
I have a javascript variable that I need to pass into a PHP block:
<script language="JavaScript">
<!-- Begin
function checkRadios() {
storeNum = document.storeSelector.storeRadio.value;
<?php
$storesVisited = fopen("beenthere_$NetID.txt" , "a+");//open file for
$storeNum = storeNum; //set PHP variable to JS variable
echo "alert($storeNum);";
fputs($storesVisited , $storeNum); //write variable to file
fclose($storesVisited); //close file
echo "alert($storeNum);";
?>
return true;
}
// End -->
</script>
The alerts both work as expected and output the contents of the JS variable (e.g. "Store1").
When viewing the text file however it has the variable name "storeNum", not the contents of the variable.
Help!?
PLease respond soonest as this is the last hangup to complete a project.
TIA,
Bryan