Page 1 of 1

writing to file

Posted: Wed Mar 10, 2010 2:24 am
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:

Re: writing to file

Posted: Wed Mar 10, 2010 3:47 am
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.