a simple problem......

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexzhang
Forum Newbie
Posts: 2
Joined: Wed Dec 16, 2009 5:57 am

a simple problem......

Post 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;
}
dejvos
Forum Contributor
Posts: 122
Joined: Tue Mar 10, 2009 8:40 am

Re: a simple problem......

Post by dejvos »

My be you should post a code of "file.php". I'm not an augur even if I want it so much.
alexzhang
Forum Newbie
Posts: 2
Joined: Wed Dec 16, 2009 5:57 am

Re: a simple problem......

Post 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"];
?>
dejvos
Forum Contributor
Posts: 122
Joined: Tue Mar 10, 2009 8:40 am

Re: a simple problem......

Post by dejvos »

Post Reply