Jump to content
Larry Ullman's Book Forums

scottdg

Members
  • Posts

    10
  • Joined

  • Last visited

scottdg's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'll fix the doctype. I am using crimson editor right now.
  2. So where could the problem be then? I read that is usually the meaning of that error but nothing seems to be missing.
  3. "figured it out" was a poor choice of words. I am not really sure what happened but all I had to do was stop the service and restart and it worked
  4. "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\handle_calc.php on line 51" I checked the code from top to bottom 3 times so if there is a problem I am just having a hard time seeing it. Here is the code as I typed it. I appreciate any assistance you could offer. Thanks. <!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Product Cost Calculator</title> <style type="text/css" media="screen"> .number { font-weight: bold; } </style> </head> <body> <?php // Script 4.2 - handle_calc.php /*This script takes values from calculator.html and performs total cost and monthly payment calculations.*/ //Address error handling, if you want. //Get the values from the $_POST array: $price = $_POST['price']; $quantity = $_POST['quantity']; $discount = $_POST['discount']; $tax = $_POST['tax']; $shipping = $_POST['shipping']; $payments = $_POST['payments']; //Calculate the total: $total = $price * $quantity; $total = $total + $shipping; $total = $total - $discount; //Determine the tax rate $taxrate = $tax/100; $taxrate = $taxrate + 1; //Factor in the tax rate: $total = $total * $taxrate; //Calculate the monthly payments: $monthly = $total / $payments; //Print out the results: print "<p>You have selected to purchase:<br /> <span class=\"number\">$quantity</span> widget(s) at <br /> $<span class=\"number\">$price</span> price each plus a <br /> $<span class=\"number\">$shipping</span> shipping cost and a <br /> <span class=\"number\">$tax</span> percent tax rate.<br /> After your $<span class=\"number\">$discount</span> discount, the total cost is $<span class=\"number\">$total</span>.<br /> Divided over <span class=\"number\"> $payments</span> monthly payments, that would be $<span class=\"number\">$monthly</span> each.</p>"; ?> </body> </html>
  5. I forgot to mention it is windows 7 and I am using apache.
  6. As I said in my last post I used http://localhost/filename.php. With feedback.HTML I also tried including the xampp directory and I tried it by xampp/htdocs/filename.php.
  7. Thanks Larry. I noticed that you did stress that so I did try to load it through a URL but I am not sure what address to use.What exactly does http://something mean? I tried using http://localhost/feedback.html just as I would with one of the php files in earlier exercises but it did not work. I even tried variations of that using the xampp directory. I also tried just typing the file path into the URL but I assume that is the same as going to file>open and navigating to the proper directory.
  8. Thanks for the response. I have been able to create and load php files up to this point while doing the exercises. Chapter 3 is using forms so it is feedback.html that I need to load. I will look over the code again but both files look identical to what the book shows.
  9. This is probably a really stupid question but here goes anyway... I am trying to complete the exercise on Page 60 and when I submit the form I get the following result: Thank you, $title $name, for your comments. You stated that you found this example to be $response and added: $comments "; ?> I double checked the php code and everything looks fine. The only thing I can think of is I am not loading the form properly. I am using apache on my machine. The text in step 8 has me thinking I am doing something wrong because it has in parenthesis to load it through a URL (http://something). I tried loading it as http://localhost/feedback.html but that doesn't work. The only way I can open the file is by putting the path to the directory in the URL. I am sure I am making a stupid mistake. Thanks in advance. Scott
×
×
  • Create New...