Could someone help me with this?

Could someone help me with this? The php code writes the html file but it doesn’t work.

[php]

<?php $new_file = "new-file.html"; $handle = fopen($new_file, 'w') or die('Cannot open file: '.$new_file); $data =" New-file
text
"; fwrite($handle, $data); ?>

[/php]

What doesn’t work exactly?

The html file. When I press the button it doesn’t show the hidden div.

Your problem is that you have single quotes inside of single quotes (syntax error)

onClick='document.getElementById('HiddenDiv').style.display='block';'

If you change the onclick to double quotes it should work.

onClick="document.getElementById('HiddenDiv').style.display='block';"

If I do that I get an error: “Parse error: syntax error, unexpected ‘document’ (T_STRING)”.

You still need to escape double quotes in double quotes

[php]$data = “onClick=“document.getElementById(‘HiddenDiv’).style.display=‘block’;””;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service