这代码怎么生成不了文件

这代码怎么生成不了文件

大家好啊,我按照《PHP和mysql web开发》那书上说的做代码生成文件的第二节学习,可是生成不了文件里的东西,我把那帖出来大家运行一下看看啊:

orderform.html 里的代码:

<body>
<form id="form2" name="form2" method="post" action="processorder.php">
  <table width="500" height="200" border="1">
    <tr>
      <td width="181" align="center" valign="middle">Item</td>
      <td width="303" align="center"> Quantuty</td>
    </tr>
    <tr>
      <td align="center">Tires</td>
      <td height="30" align="center"><label>
        <input name="tireqty" type="text" id="tireqty" />
      </label></td>
    </tr>
    <tr>
      <td align="center">Oil</td>
      <td align="center"><label>
        <input name="oilqty" type="text" id="oilqty" />
      </label></td>
    </tr>
    <tr>
      <td align="center">Spark Plug</td>
      <td align="center"><label>
        <input name="sparkqty" type="text" id="sparkqty" />
      </label></td>
    </tr>
    <tr>
      <td align="center"><label>Shipping Address </label></td>
      <td align="center">
<!--  <td> How did you find Bob's</td>-->
<label>
<input type="text" name="address" id="address" />
</label></td>
    </tr>
    <tr>
      <td align="center"><input type="submit" name="Submit22" value="提交" /></td>
      <td align="center"> </td>
    </tr>
    <tr>
      <td align="center">How did you find Bob's</td>
      <td align="center"><select name="select2">
        <option value="a">I'm a regular customer</option>
        <option value="b">TV advertising</option>
        <option value="c">hone directory</option>
        <option value="d">Word of mouth</option>
      </select></td>
    </tr>
  </table>
  <p> </p>
  <p> </p>
</form>
<p> </p>
</body>

processorder.php里的代码:

<body>
<?php
  echo ' Bob Auto Parts <p>';
  echo 'order Results :';
  echo date('h :i, jS F');
  echo '<p>';
  $date = date('h:i,jS F');

  echo '<p>Your order is as follows<p>';
   
  $totalqty = 0 ;
  $totalamount =0.00 ;
  
  define('TIREPRICE',100);  //define定义常量 TIREPRICE 常量 100 常量值
  define('OILPRICE',10);
  define('SPARKPRICE',4);   
  $totalqty = $tireqty + $oilqty + $sparkqty;
  echo 'Items ordered:'.$totalqty.'<br/>';
  
  //-----if语句---------
  if($totalqty ==0 )
  {
   echo 'you did not order anthing on the previous page!<br/>';
   exit;
   }
  
  else
  {
   
   if($tireqty>0)
   echo $tireqty."\n tires<br/>";
   else
   {
    echo "your tureqty input is wrong";
    exit;
   }
   if($oilqty>0)
   echo $oilqty."\n bottles of oil<br/>";
   else {
    echo "your oilqty inpout is wrong<br/>";
    exit;
   
   }
   if($sparkqty>0)
   echo $sparkqty."\n spark plugs<br/>";
   else{
    echo "your sparkqty input is wrong<br/>";
    exit;
   }
   if($address!='')
   echo $address."\n shipping address<br/>";
  }  
  $totalamount = $tireqty*TIREPRICE
      +$oilqty*OILPRICE
      +$sparkqty*SPARKPRICE;
  echo 'Subtotal'.number_format($totalamount,2).'<br/>'; //number_format(..,2)控制为两位小数
  
  $taxrate = 0.10;
  $totalamount = $totalamount *(1+$taxrate);
  echo 'Total including tax '.number_format($totalamount,2).'<p/>';
  echo '<p>Address to ship to is '.$address.'</p>';
  //-----------------
  //$fp = fopen("$DOCUMENT_ROOT/../orders.txt",'ab',true);//存在文件内
  
  $outputstring = $date."\t".$tireqty."tires \t".$oilqty."oil\t".$sparkqty." spark plugs\t\$"
                  .$totalamount."\t".$address."\n";
  //$write($fp,$outputstring,strlen($outputstring));
  @ $fp = fopen("$DOCUMENT_ROOT/../orders.txt",'ab');//$DOCUMENT_ROOT/../orders.txt路可改,可自己手动建orders.txt
    if(!$fp)
    {
      echo '<p><strong> Your order could not be processed at this time.
       Please try again later.</strong></p></body></html>';
      exit;      
    }
   
    fwrite($fp,$outputstring,strlen($outputstring));
    fclose($fp);
    echo '<p>Order written.</p>';
  
  //---------------
  $a = 50;
  echo gettype($a).'<br/>';
  settype($a , 'double');
  echo gettype($a).'<br/>';
  
  
  echo '此项已经填写'.isset($tireqty).'<br/>';
  echo "此项没有".isset($nothing).'<br/>';
  
  echo 'empty($treyqty):'.empty($tireqty).'<br/>';
  echo 'empty($nothing):'.empty($nothing).'<p/>';
  
?>
</body>

请您运行一下看能不能生成文件,保存数据啊,找到原因请告诉我啊,再下感激不尽(代码没有错误,就是生成不了文件,保存不了数据)...我QQ:88135158

会不会是权限的问题。
你有没有写的权限。
毕业了。。。