Hello

I'm trying to modify an old code to make it work a little different than its actual function. But i'm confused with the exact way of writing my code.

My actual try is:

admin.php:
[...]
$file2 = 'admin/cv.php';
[...]
// CV section -->
if ( $action == 'cv' )
{
htmlhead('on');
?>
<TABLE WIDTH="800" CELLPADDING="10" BORDER=0 BGCOLOR=#FFFFFF>
<TR>
<TD ALIGN="center" valign=center>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<textarea style="width:750px;height:600px" wrap=PHYSICAL name="text2"><?=$cv ?></textarea>
</TD>
</TR>
<TR>
<TD align="right" align="top">
<input type=hidden name=action value="save2" />
<input style="width:100px" type="submit" value="Ok" />
</form>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="show" />
<input style="width:100px" type="submit" value="Preview" />
</form>
</TD>
</TR>
</TABLE>
}

// save2 (action called by my CV section-->
if ( $action == 'save2' || $save2 == 'true' )
{
$text2 = trim($text2);
if ( $text2 !='' )
{
$text2 = ereg_replace("\\\'", "'", $text2); // make the quotes visible ' --> '

$datastring2 .= '$cv = '."'".$text2."';\n";

$data2 = '<?php'."\n".$datastring2.'?>';

$data2 = ereg_replace('\\\"', '"', $data2); // remove escaping from doublequotes \"

$fp2 = fopen($file2,"w+");
fputs($fp2,$data2);
fclose($fp2);

header("Location: ".$_SERVER['PHP_SELF']."?action=show"); // Stop the reload problem
}
[...]

called admin/cv.php:

<?php
$cv = '
Born in 1979. Lives and works in Montreal.
';
?>


FINALY I just want that my $save2 function replace my actual $cv by the new input in $text2.
Briefly, i think my problem is located only in this function ( $save2 )

Thank you in advance, btw, i wish my request make sens !
My english are bad sometimes.