Jump to content

bscotyb

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bscotyb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i can not get this to show the numbers when i run my php. i know i am missing something simple, it is probably one of my variables, can someone please help me with this for my class, ty html <html> <head> <title>Software2</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>SOFTWARE ORDERS: REPORT</h1> <form action = "software2Boles.php" method = "post" > <p><input type = "submit" value = "Display the Report" /></p> </form> </body> </html> txt. 1 Linux:1 2 Macintosh:1 3 Windows:1 4 Macintosh:1 5 Macintosh:2 6 Linux:5 7 Macintosh:10 8 Windows:10 9 Macintosh:1 10 Windows:1 11 Windows:1 12 Linux:1 13 Macintosh:5 14 Linux:4 15 Windows:1 16 Macintosh:1 17 Windows:1 18 Linux:2 19 Macintosh:2 20 Windows:1 21 <!--Author: Larry Boles Date: April 21, 2012 File: software2.php Purpose:Chapter 10 Lab --> <html> <head> <title>Software2</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <?php $multipleOrders = 0; $linuxCopies = 0; $macintoshCopies = 0; $windowsCopies = 0; $orderFile = fopen("ordersBoles.txt", "r"); $nextOrder = fgets ($orderFile); while (!feof($orderFile)) { list($os,$copies) = split (":", $nextOrder); { if ($os == "Linux") { $linuxCopies = $copies + 1; } if ($os == "Macintosh") { $macintoshCopies = $copies +1;} if ($os == "Windows" ) { $windowsCopies = $copies + 1; } if ($os == "Multiple") { $multipleCopies = $copies + 1; } } } $nextOrder = fgets ($orderFile); } fclose($orderFile); print ("<h1>SOFTWARE ORDERS: REPORT</h1>"); print ("<p>ORDERS FOR MULTIPLE COPIES: $multipleOrders</p>"); print ("<p>LINUX COPIES ORDERED: $linuxCopies</p>"); print ("<p>MACINTOSH COPIES ORDERED: $macintoshCopies</p>"); print ("<p>WINDOWS COPIES ORDERED: $windowsCopies</p>"); ?> </body> </html>
  2. i am a student and trying to figure out why this is not working for me i am trying to pull from my .txt file and add the lines. $numOrders should be 20 and $numCopies should be 52. it keeps telling me --Warning: feof() expects parameter 1 to be resource, string given on line 25. i really am having big trouble trying to understand how to use the while loop for this. any help would be great. here is my html code <html> <head> <title>Software1</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>SOFTWARE ORDERS: REPORT</h1> <form action = "software1Boles.php" method = "post" > <p><input type = "submit" value = "Display the Report" /></p> </form> </body> </html> my php code <?php $totalCopies = $_POST['totalCopies']; $totalOrders = $_POST['totalOrders']; $nextOrder = $_POST['nextOrder']; $totalCopies = 0; $totalOrders = 0; $orderFile = fopen("ordersBoles.txt", "r"); $nextOrder = fgets ($orderFile); while (!feof($nextOrder)) { list($totalCopies, $totalOrders) = explode (":", $nextOrder); if ($totalCopies >=1 and $totalCopies >=1) { $totalCopies = $totalCopies + $nextOrder; $totalOrder = $totalOrder + $nextOrder; } $nextOrder = fgets($orderFile);} fclose($orderFile); print ("<h1>SOFTWARE ORDERS: REPORT</h1>"); print ("<p>TOTAL COPIES ORDERED: $totalCopies</p>"); print ("<p>TOTAL ORDERS: $totalOrders</p>"); ?> </body> </html> and my .txt file 1 Linux:1 2 Macintosh:1 3 Windows:1 4 Macintosh:1 5 Macintosh:2 6 Linux:5 7 Macintosh:10 8 Windows:10 9 Macintosh:1 10 Windows:1 11 Windows:1 12 Linux:1 13 Macintosh:5 14 Linux:4 15 Windows:1 16 Macintosh:1 17 Windows:1 18 Linux:2 19 Macintosh:2 20 Windows:1 21 anything you can give me would help alot, thanks
  3. it is missing line 1 weeklyDataBoles.txt txt.file 1 236.00 2 284.00 3 148.00 4 128.00 5 0.00 6 110.00 7 0.00 8
  4. i am trying to pull a .txt file for a class assignment and it is pulling everything except for line 1 any suggestions would be great html: <html> <head> <title>Weekly Report</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>Weekly Report</h1> <p> <form action = "weeklyReport1Boles.php" method = "post" > <p> <input type = "submit" value = "Display the Report" /> </p> </form> </body> </html> txt.file 1 236.00 2 284.00 3 148.00 4 128.00 5 0.00 6 110.00 7 0.00 8 php file: <?php $total = $_POST['total']; $avgDailyIncome = $_POST['avgDailyIncome']; $badDays = $_POST ['badDays']; $paintFile = $_POST ['paintfile']; $nextDay = $_POST['nextDay']; $paintFile = fopen("weeklyDataBoles.txt","r"); $week = fgets($paintFile); $total = 0; for ($count = 1; $count <=8; $count = $count +1) { $nextDay = fgets($paintFile); $total = $total + $nextDay; } $avgDailyIncome = $total/7; print("<p>TOTAL INCOME FROM PAINT CONTRACTS: "); print("$".number_format($total, 2)."</p>"); print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: "); print("$".number_format($avgDailyIncome, 2)."</p>"); print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>"); ?> </body> </html>
  5. i am not asking for much, i am trying and i am really confused all i was really asking for was a little help, i am sorry if my inexperience is a bad thing here, i am trying as hard as i can to understand just having alot of problems getting it
  6. i am a student trying to figure this out and no matter what i do it is not coming up correctly I am trying to use this weeklyReport1Boles.html: <html><head> <title>Weekly Report</title> <link rel ="stylesheet" type="text/css" href="sample.css" /></head><body> <h1>Weekly Report</h1> <p> <form action = "weeklyReport1Boles.php" method = "post" > <p> <input type = "submit" value = "Display the Report" /></p> </form> </body> </html> TO PULL data from weeklyDataBoles.txt lines 1-8 1 236.00 2 284.00 3 148.00 4 128.00 5 0.00 6 110.00 7 0.00 8 the resulting web page should be: Weekly Report TOTAL INCOME FROM PAINT CONTRACTS: $0.00 AVG DAILY INCOME FROM PAINT CONTRACTS: $0.00 NUMBER OF DAYS with NO INCOME: . ny php code is : <?php $total = $_POST['total']; $avgDailyIncome = $_POST['avgDailyIncome']; $badDays = $_POST ['badDays']; $paintFile = fopen("weeklyDataBoles.txt","r"); $year = fgets($weeklyDataBoles);$total = 0; for ($count= 1; $count <=7; $count = $count +1) { $ nextDay = fgets($weeklyDataBoles); $total = $total + $nextDay; } fclose($weeklyData); $avgDailyIncome = $total/7; print("<p>TOTAL INCOME FROM PAINT CONTRACTS: "); print("$".number_format($total, 2)."</p>"); print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: "); print("$".number_format($avgDailyIncome, 2)."</p>"); print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>"); ?> </body> </html> I am very inexperienced and would love any help offered. Please remember I am a student so my code may be in the shambles already. ty
  7. sorry about the caps new to this and desperately trying to understand, ty for understanding
  8. I am trying to use this weeklyReport1Boles.html: <html> <head> <title>Weekly Report</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>Weekly Report</h1> <p> <form action = "weeklyReport1Boles.php" method = "post" > <p> <input type = "submit" value = "Display the Report" /> </p> </form> </body> </html> TO PULL data from weeklyDataBoles.txt lines 1-8 1 236.00 2 284.00 3 148.00 4 128.00 5 0.00 6 110.00 7 0.00 8 THE RESULTING WEB PAGE SHOULD BE: Weekly Report TOTAL INCOME FROM PAINT CONTRACTS: $0.00 AVG DAILY INCOME FROM PAINT CONTRACTS: $0.00 NUMBER OF DAYS with NO INCOME: . MY PHP CODE IS: <?php $total = $_POST['total']; $avgDailyIncome = $_POST['avgDailyIncome']; $badDays = $_POST ['badDays']; $paintFile = fopen("weeklyDataBoles.txt","r"); $year = fgets($weeklyDataBoles); $total = 0; for ($count= 1; $count <=7; $count = $count +1) { $nextDay = fgets($weeklyDataBoles); $total = $total + $nextDay; } fclose($weeklyData); $avgDailyIncome = $total/7; print("<p>TOTAL INCOME FROM PAINT CONTRACTS: "); print("$".number_format($total, 2)."</p>"); print("<p>AVG DAILY INCOME FROM PAINT CONTRACTS: "); print("$".number_format($avgDailyIncome, 2)."</p>"); print("<p>NUMBER OF DAYS with NO INCOME: $badDays.</p>"); ?> </body> </html> THE AVERAGES ARE BASED ON ONE WEEK OR SEVEN DAYS, WHY CANT I OPEN THE FILE AND GET THE PROGRAM TO READ IT, I AM A STUDENT AND VERY, VERY, VERY BAD AT THIS, MAKES ME CRAZY CAUSE I REALLY LOVE IT
  9. bscotyb

    loops

    i suck at this thanks
  10. bscotyb

    loops

    that really helped me alot appreciate it, now i have one more question when i input in the html start with: 10 End with: 20 Increment by: 2 in the html it wont square 20 still give me square for 18 what did i do wrong now, <?php $startNum = $_POST['startNum']; $endNum = $_POST['endNum']; $increment = $_POST['increment']; $square = $_POST['square']; print ("<h1>SQUARES</h1><hr />"); for($startNum = $startNum; $startNum < $endNum; $startNum = $startNum += $increment) { $square = $startNum * $startNum; print("The square of " . $startNum . " is " . $square . "<br/>\n");} { print("The square of " . $startNum . " is " . $square . "<br/>\n");} print ("<hr />"); ?>
  11. bscotyb

    loops

    i am having issues with my class work. this needs to start at the $startNum and end with the $endNum and display results in the increments submitted by the html. I can not get it to print out correctly it is supposed to say: The square of $startNum is $square //until it hits the end number and is going up by the correct increments, It wont go up by any increments and only shows a list if i leave out the increment-----any suggestions??? please i have to keep it very simple since i am just learning-ty html </head> <body> <h1>Squares</h1> <p> <form action = "squares2Boles.php" method = "post" > <p>Start with: <input type = "text" size = "5" name = "startNum" /> </p><p>End with: <input type = "text" size = "5" name = "endNum" /> </p><p>Increment by: <input type = "text" size = "5" name = "increment" /> </p><p><input type = "submit" value = "Display the Squares" /></p> </form> </body> </html> my php: <html> <head> <title>Squares</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <?php $startNum = $_POST['startNum']; $endNum = $_POST['endNum']; $increment = $_POST['increment']; $square = $_POST['square']; print ("<h1>SQUARES</h1><hr />"); for ($startNum = $startNum; $startNum <= $endNum; $startNum = $startNum + $increment) { $square = $startNum * $startNum; print ("The square of $startNum is $square<br />"); } print ("<hr />"); ?> </body> </html>
  12. <html> <head> <title>Travel</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>Travel Reservation Form</h1> <p> <form action = "travelBoles.php" method = "post" > <table> <tr><td>Select your vacation destination</td> <td><select name = "destination" /> <option>Barcelona</option> <option>Cairo</option> <option>Rome</option> <option>Santiago</option> <option>Tokyo</option> </select></td></tr> <tr><td>How many people are traveling?</td> <td><input type = "text" size = "5" name = "numTravelers" /></td> </tr><tr><td>How many nights will you be staying?</td> <td><input type = "text" size = "5" name = "numNights" /></td></tr> </table> <p><input type = "submit" value = "Submit Your Reservation" /></p> </form> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.