writing to file

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
robhofen
Forum Newbie
Posts: 1
Joined: Wed Mar 10, 2010 2:16 am

writing to file

Post by robhofen »

im having trouble writing to file using php

Code: Select all

 
<table width="590" border="1">
  <tr>
    <td width="129">Your Name is </td>
    <td width="335"><?php echo $_POST["fname"]; ?></td>
  </tr>
  <tr>
    <td>You are</td>
    <td><?php echo $_POST["age"]; ?> Years Old </td>
  </tr>
  <tr>
    <td>Your Address is!</td>
    <td><?php echo $_POST["address"]; ?></td>
  </tr>
  <tr>
    <td height="45">Your Favroute Ice cream is</td>
    <td><?php echo $_REQUEST["icecream"]; ?></td>
  </tr>
</table>
<br /> 
Thank You for you time </td>
 
<?php   @ $fp = fopen("data.txt", 'ab');
 fwrite($fname,$age,$address,$icecream));
    fclose($fp);
    ?>
 
and i get the error code Parse error: parse error in C:\wamp\www\SD\Data.php on line 24 which means fwright isnt working
What am i doing wrong :banghead:
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: writing to file

Post by Weirdan »

robhofen wrote:and i get the error code Parse error: parse error in C:\wamp\www\SD\Data.php on line 24 which means fwright isnt working
Nope, it means you have a syntax error on that line (two closing braces where only one should be). Also check the documentation for fwrite - you're passing wrong parameters to it.
Post Reply