bassey inyang's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
8 (0.01 per day)
Joined:
07-July 11
Profile Views:
349
Last Active:
User is offline Aug 07 2011 12:19 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   bassey inyang has not set their status

Posts I've Made

  1. In Topic: errors generated while opening flat text file in php

    Posted 7 Aug 2011

    Thanks every one for responding especially Rudi I am moving ahead to learn arrays and a whole bunch of other php stuffs.
    looking forward to learning mysql.
    Thanks
    bassey
  2. In Topic: errors generated while opening flat text file in php

    Posted 6 Aug 2011

    tried did'nt work out:
    <?php
      // create short variable names
      $tireqty = $_POST['tireqty'];
      $oilqty = $_POST['oilqty'];
      $sparkqty = $_POST['sparkqty'];
      $address = $_POST['address'];
      $filepath = $_SERVER['DOCUMENT_ROOT'];
      
    ?>
    <html>
    <head>
      <title>Bob's Auto Parts - Order Results</title>
    </head>
    <body>
    <h1>Bob's Auto Parts</h1>
    <h2>Order Results</h2>
    <?php
    echo "<p>Order processed at ".date('H:i, jS F Y')."</p>";
    
    	echo '<p>Your order is as follows: </p>';
    
    	$totalqty = 0;
    	$totalqty = $tireqty + $oilqty + $sparkqty;
    	echo "Items ordered: ".$totalqty."<br />";
    	$totalamount= 0.00;
    	
    	define('TIREPRICE', 100);
        define('OILPRICE', 10);
        define('SPARKPRICE', 4);
      $totalamount = $tireqty * TIREPRICE
    				 + $oilqty * OILPRICE
    				 + $sparkqty * SPARKPRICE;
    	echo "Subtotal: $".number_format($totalamount,2)."<br />";
    		$taxrate = 0.10;  // local sales tax is 10%
    	$totalamount = $totalamount * (1 + $taxrate);
    	echo "Total including tax: $".number_format($totalamount,2)."<br />";
    			echo "<p>Total of order is $".$totalamount."</p>";
    	echo "<p>Address to ship to is ".$address."</p>"; 
    	
    	$filePath = realpath(DOCUMENT_ROOT . '/../order/order.txt');
        echo $filePath;
        $fp = fopen($filePath, 'c');
    
    
    
      
        
    ?>
    </body>
    </html>
    
    
    

    I set the security to allow for files to be written and read created order/order.text uploaded to wamp server,
    still generated the error:Use of undefined constant DOCUMENT_ROOT - assumed 'DOCUMENT_ROOT' in C:\wamp\www\processorder.php on line 40.
    thanks
  3. In Topic: errors generated while opening flat text file in php

    Posted 6 Aug 2011

    sorry about that everyone, it is actually supposed to be:
      $order = $_POST['order'];
    	  $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
    	<?php
    	 
    	// open file for appending
    	     $fp = fopen("$DOCUMENT_ROOT/../order/order.txt", 'w'); 
    	?>
    

    I use a WAMP and had uploaded order. txt. I want the user to be able to write his address in the form and the input to be stored in a text file.
    but if i run the code on a broswer it generates:( ! ) Warning: fopen(C:/wamp/www//../orders/orders.txt) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\processorder.php on line. I am using a wamp (just learning the language.)
    I guess i don't have permission to to write or read a file how do i solve the problem run a windows with wamp server.
    My problem is just to know who to create a order.txt test it to know it is working so I can write to it and read from it.
    guess must have been stressed up when i wrote the first post.
    thanks
  4. In Topic: Errors generated testing my php code using wamp server!

    Posted 31 Jul 2011

    Thank you all for reading my post and putting me through, I did it the other way round but when I typed into the browser I got the expected response but I still do have a question.
    Thus this mean that if i write a code that needs testing I have to save it in the www directory before running the test?
    I am quite new to all these so pardon me if i am asking all the wrong questions.
    I love you guys for free,
    biting myself for not knowing you guys a long time ago

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

bassey inyang has no profile comments yet. Why not say hello?