Logical1
-
Posts
56 -
Joined
-
Last visited
Never
Posts posted by Logical1
-
-
Hello
Can anyone give an example or explain how to generate a text file on the viewers' desktop (or wherever they choose) ?
I am trying to give an option to copy parts of the text on my page and save it as a text file for the viewer. So to avoid a couple of clicks and copy and paste.
I have found a lot of info about writing to a text file, but they all get saved on MY server, but they should be on the VIWER'S computer.
Thanks in adavance.
PS. The code I am using right now is pasted bellow but as I said it does not get saved for the viewer.
<?php
$File = date("m").".txt";
$Handle = fopen($File, 'w');
$Data = "Test data bla bla bla \n\n";
fwrite($Handle, $Data);
fclose($Handle);
?>
-
Thanks it works now.
-
If the issue is that I have to change the code how come it was working before in the old server and not here anymore? If I can avoid having to go through 1000s of lines of codes for different sections by changing the setting or flags I think I better do that? what do you think? What should be changed in the PHP setting?
Thanks in advance for the replies .
-
Thank you guys for so many replies.
I made a typing mistake: old host had PHP 4 and the new one has PHP 5.1.6 (I wrote 4 again).
i added that code you suggested on top of the page and am getting a lot of errors . Here they are:
Notice: Undefined variable: C1_wanted in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 55
Notice: Undefined variable: C2_wanted in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 69
Notice: Undefined variable: C3_wanted in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 83
Notice: Undefined variable: C4_wanted in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 96
Notice: Undefined variable: CV2 in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 109
Notice: Undefined variable: CV1 in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 109
Notice: Undefined variable: CV3 in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 109
Notice: Undefined variable: CV4 in /var/www/vhosts/zingzing.com/httpdocs/F/2/calculate.php on line 109
This exact code was working on the old server why should it not be working on the new one? Any idea as how to solve the problem?
Thanks in advance
-
Hello
I moved my site from an older host which was running PHP 4 to another one which had PHP4 and am getting error messages saying variables not defined.
Variables are filled through input boxes and send to the next page to be send to the next page for a calculation but they do not get recognized in this second page. The host company's (Hostway, avoid them like hell) misrable support says it has to do with setting of flags on PHP and they want $150 to fix the problem! How can I fix this myslef?
In case it help you to understand the problem better I post part of the code here:
<form method=POST action=calculate.php>
<input type=text name=NAME1>
<input type=text name=COURS1>
<input type=text name=FEE1>
<input type=submit>
</form>
In the next page (calculate.php) I have:
Hello <?php print $NAME1 ?>
but nothing is seen (error log shows says that variable NAME1 is not defined!)
Write to a text file
in PHP Coding Help
Posted
The contant is different depending on what blog or message they will see. So it won't be a practical solution. I can create and fill the text file but it all is done invisibly. If I could keep the file open so the viewer can see it they can choose a location and save.
Question is how to do that?