<html>
<head>
<script type="text/javascript">
function myfunc()
{
<?php
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Hi there!";
fwrite($fh, $stringData);
fclose($fh);
?>
}
</script>
</head>
<body>
<input type="button" onclick="myfunc()" value="Click!" />
</body>
</html>
<html>
<head>
<?php
function myfunc()
{
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Hi there!";
fwrite($fh, $stringData);
fclose($fh);
}
?>
</head>
<body>
<input type="button" onclick="myfunc()" value="Click!" />
</body>
</html>
I know it would be easier to just have an html file and a php file, but I'd really like to have it all in one page. If anyone can help, I'd really appreciate it.
This post has been edited by steevo301: 17 November 2008 - 06:27 PM

New Topic/Question
Reply



MultiQuote







|