Page 1 of 1

a simple problem......

Posted: Wed Dec 16, 2009 6:02 am
by alexzhang
i use the <form method=post action=file.php>
<textarea................
submit the below textfile ,then $fp = fopen( "$time_start.c", "w" );
and fwrite the text to the file ,but why " -> \" ,,,,
#include <iostream>
using namespace std;
void main()
{
cout << "Hello World!" << endl;
cout << "Welcome to C++ Programming" << endl;
}


#include <iostream>
using namespace std;
void main()
{
cout << \"Hello World!\" << endl;
cout << \"Welcome to C++ Programming\" << endl;
}

Re: a simple problem......

Posted: Wed Dec 16, 2009 7:16 am
by dejvos
My be you should post a code of "file.php". I'm not an augur even if I want it so much.

Re: a simple problem......

Posted: Wed Dec 16, 2009 7:20 am
by alexzhang
<?php
//$filename=date("Y.m.d");
function microtime_float() //since the Unix Epoch (0:00:00 January 1, 1970 GMT)
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();
$fp = fopen( "$time_start.c", "w" );
fwrite($fp,$_POST["text"]);
fclose($fp);
print "your name is ";
print $_POST["text"];
?>

Re: a simple problem......

Posted: Wed Dec 16, 2009 8:48 am
by dejvos