Cannot read and write html files

I can read an html file ok, but I cannot write the same file back.
This is the file that I read.

_District # <?echo "$dl[0]"?> <?echo "$dl[3]"?>"> " SELECTED><?echo "$ht[0] $ht[1]"?> add any comments<<

This the file that I write.

<html>
<form name="form2" method="post" action="process form.php">
<SELECT NAME="<?echo "$dl[1] $dl[2]"?>_District # <?echo "$dl[0]"?> <?echo "$dl[3]"?>">
<OPTION value="<?echo "$ht[0] $ht[1]"?>" SELECTED><?echo "$ht[0] $ht[1]"?></OPTION></select></td>
<center><textarea name="text" align=middle rows=5 cols=60></textarea>add any comments<<
<center><input type="submit" value="Click Here To Send Form"/>
</html>

I tried the following code but could not make it work.

htmlspecialchars()
htmlentities()
html_entity_decode ()

How can I write the same code back to the same file??
Thanks
Clint Mason

Hi there,

First I have to ask, if you’re writing the same data back to the same file, what’s the point ???. Surely that’s exactly the same as just not doing anything to the file lol.

Secondly, can you post the code that reads and writes.

Is it on your webhost that you cannot read/write?

Because maybe you didn’t set the file CHMOD permissions properly.

I can read the html file ok. I change the file name and write it back to the new file but the data in the new file is in code.

This is the data that is written in the new file.

<html>
<form name="form2" method="post" action="process form.php">
<SELECT NAME="<?echo "$dl[1] $dl[2]"?>_District # <?echo "$dl[0]"?> <?echo "$dl[3]"?>">
<OPTION value="<?echo "$ht[0] $ht[1]"?>" SELECTED><?echo "$ht[0] $ht[1]"?></OPTION></select></td>
<center><textarea name="text" align=middle rows=5 cols=60></textarea>add any comments<<
<center><input type="submit" value="Click Here To Send Form"/>
</html>

Clint

Sponsor our Newsletter | Privacy Policy | Terms of Service