Jump to content
Larry Ullman's Book Forums

nshaw

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by nshaw

  1. This should provide additional clarity to what I've done thus far: First, I'm running Windows Ultimate 64 on an Alienware 18 with 32GB memory. I'm using XAMPP. For the include statement, I went to windows explorer and copied as text the address line: C:\xampp\htdocs\HTMLtemplate\includes. I pasted this in and added \header.html. Result: no change. I reversed the \ to / (UNIX/Linux style). Result: no change. That was my absolute address attempt. I tried (based upon the start of the thread) './' before the includes hoping that ./ which = current directory would work. Result: no change. I went into the 'header.html' and instead of loading it, copied the contents right into the file and modified calculator accordingly. If this worked then it wasn't the header.html file (working to identify what isn't the problem). Result: some change. Question - in the beginning of chapter 3, header.html is created and part of that header contains the five buttons (Home Page, Calculator, etc.) plus 'Your Website', etc. None of the above is shown in what should be the output, i.e. 'Total Estimated Cost' and 'Trip Cost Calculator'. I've gone over the book from the beginning of chapter 3 up to the displays and nothing says (or indicates) that what is shown is a portion of what is actually seen. Ergo, I'm expecting the output to be exactly as shown in the book. If that is correct, the header code is incorrect, i.e. more of the header should have been removed. But no one else is experiencing this and the book is 3 years old and the errata sheet indicates nothing so I can only conclude that the header code is correct and something else is the issue. My apologies if I'm over thinking this - because the code should work, I'm starting to go a bit batty here. Again, in advance, thanks! Nick.
  2. What is really interesting is the comments are showing which, at first, indicated there was an open comment so everything was displaying until the next comment closing (multiline) but that wasn't the case either. Best Regards, Nick.
  3. I thought that at first so loaded it directly into Firefox, i.e. 'File/Open File'. I've done that often to test outside of NetBeans. So it isn't NetBeans. I even opened 'calculator.php' into my other editor 'notepad plus' which I really like on Linux then load into Firefox and still no go.
  4. Hope you all don't mind me jumping in. I'm an absolute newbie to web programming and PHP. I'm having a problem getting the calculator program to work (3.5). I inserted the code directly into NetBeans 8.0.1 and no go. Based upon this discussion, I tried using the absolute path and I tried putting the include files in the same directory as the calculator file and commenting out the include. No success. The actual calculator portion works but there appears to be an error above. This is what I get for the top of the program: Total Estimated Cost The total cost of driving ' . $_POST['distance'] . ' miles, averaging ' . $_POST['efficiency'] . ' miles per gallon, and paying an average of $' . $_POST['gallon_price'] . ' per gallon, is $' . number_format ($dollars, 2) . '. If you drive at an average of 65 miles per hour, the trip will take approximately ' . number_format($hours, 2) . ' hours. '; } else { // Invalid submitted values. echo ' Error!Please enter a valid distance, price per gallon, and fuel efficiency. '; } } // End of main submission IF. // Leave the PHP section and create the HTML form: ?> The bottom looks ok, i.e. everything from 'Trip Cost Calculator' and below is as it should be. Trip Cost CalculatorDistance (in miles): Ave. Price Per Gallon: 3.00 3.50 4.00 Fuel Efficiency: Any help would be greatly appreciated. I've tried everything I can but without the web knowledge, I'm stuck. Thanks! Nick.
  5. Ok, finally got it to work. I opened NetBeans again and created a new project. I put both files in the new project folder (it wanted to put the second file elsewhere). The first file is named index.php and the second handle_form.php. I don't know why this works and not putting both files in htdocs but it does.
  6. This is frustrating... I started on this yesterday and started again this morning. Apache is up-and-running fine. form.php runs correctly and it calls handle_form.php; both are in the same directory. But the output is as follows: Thank you, $name, for the following comments: $comments We will reply to you at $email. \n"; ?> The \"; ?> line indicated that there was an error in the code such as no termination but that isn't the case and all multiline comments are terminated correctly. Here are my debugging steps: 1. Code named per the book (form.php and handle_form.php) - check 2. Code placed in the same directory (htdocs) - check NetBeans, by default, places code in a subdirectory of the project name so I copied the files from the project to "htdoc" when this didn't work yesterday. After copying the files, if I needed to edit the files, I used Notepad++, an excellent editor I use in Linux. 3. form.php was loaded into Firefox via 'File/Open File'. 4. Checked spelling and capitalization - correct (name=name, email=email, and comments=comments) 5. Checked for errors in echo, i.e. did I type correctly $name, $email, and $comments - no errors there. 6. Did I use a single quote versus double for echo? No. 7. Did I forget the semicolon at the end of echo? No. 8. I entered in the code myself the first time to learn/comment so now I copied your code without change. Result: no change. 9. Checked the errata sheet again - nothing until chapter 3. In short, I followed the steps and the code is the same as your code and still no success. Up to this point, all of the code has worked using NetBeans 8.0.1. Only with this code did I copy the code to htdoc and edit using Notepad++ when it didn't work in NetBeans. In Notepad++, I selected 'PHP' as the language. I'd attach the files but don't see the capability; however, they're the files from phpmysql4_scripts.zip. Help... In advance - thank you! Nicholas.
  7. Good afternoon, I purchased the Kindle version. I run Kindle PC with your book open on one 25" monitor and I code using NetBeans with PHP on another 25" monitor. Two things I've noticed: 1. In chapter 1, you define 3 ways to comment. The multiline comment /* */ doesn't come across in the Kindle book correctly. It states / (start) / (end). Fortunately, I decided to try a C++ multiline comment and it worked. I then saw in one of your tips later on, where the comment came through correctly so it may be a code conversion issue. 2. Also in chapter 1, when you discuss arithmetic operations, none of your operators are present. For example, in the first program, you have 30 items ($quantity) at a cost of 119.95 ($price) and you multiply the two $total = $quantity * $price. But in the Kindle version, it comes out $total = $quantity $price. All equations in chapter 1 (haven't gone beyond that yet) are similarly missing the operators. Of the two, #1 could cause newcomers to programming not to use multiline comments unless they happen to move forward to your tips. Since I didn't see it in your errata, felt I should pass these along. Best Regards, Nicholas.
×
×
  • Create New...