Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'chapter 3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 5 results

  1. On page 92, Chapter 3, making sticky forms: In this chapter a form is created with PHP used to create a text field for inputting distance. Code then validates the content to make sure it is present and a number. The form remembers what was entered so that if an error is thrown the previous input is still there. The following code is used to remember the distance entered by the user. <?php if (isset($_POST['distance'])) { echo $_POST['distance']; } ?> The book then remarks that this can be condensed onto one line, i.e. <?php if (isset($_POST['distance'])) echo $_POST['distance']; ?> but that doing so is rarely recommended. In the interests of learning best practice I decided to go with the first option of splitting out the if statement. However, I noticed that this causes issues in the resulting form in that the Distance text field contains large number of extra characters which mean that the is_numeric test always fails. This does not happen when using the if statement in a single line. Given that both syntaxes are supposed to perform the same, this is somewhat puzzling and I wondered if anyone else has encountered it or found an explanation? The full field creation is as follows in both syntaxes: <p>Distance (miles): <input type="text" name="distance" value="<?php if (isset($_POST['distance'])) echo $_POST['distance']; ?> "/></p> <p>Distance (miles): <input type="text" name="distance" value=" <?php if (isset($_POST['distance'])) { echo $_POST['distance']; } ?> "/></p> Libby
  2. Greetings to all (and especially you Larry) I'm having difficulties getting the CSS to show and I think there is something wrong with my path to CSS. I like to have things tidy and pretty so I created a subfolder in my www root called "myCMS". FileStructure = myCMS(folder) index.php assets(folder) css(folder) style.css img(folder) logo.png includes(folder) header.html footer.html I get the includes to work and they show when rendering index.html but there is no styling... In header.html I have <link href="assets/css/style.css" rel="stylesheet"> But my greenhord guess is that the path is wrong?? Ideas why CSS wont show? Cheers to all
  3. Hi guys, I've been going over chapter 3 today, script 3.10 calculator.php #5 and unless I'm being stupid (most likely) is their an error on line 30 ? Instead of (Larrys code): // Get the cost of those gallons $dollars = $gallons / $ppg; Should it not be: // Get the cost of those gallons $dollars = $gallons * $ppg; After completing the Script and running the results (submitting the form data) using $dollars = $gallons / $ppg; this just did not look right: Total Estimated Cost: The total cost of driving 300 miles, averaging 30 miles per gallon, and paying an average of $3.00 per gallon, is $3.33. If you drive at an average of 65 miles per hour, the trip will take approximately 4.62 hours. Sorry if this has been answered elsewhere (I did check the errata but it contained no reference). But I just thought I'd bring it up, and make sure I'm not having a braindead moment Cheers
  4. I get the following error when I run the sessions.php script which includes the session handler functions line 37 is the call to session_write_close(); What does this mean exactly and how do I rectify it? Incidentally there is a session text file being saved in the tmp directory referred to - its full of data that I don't understand.
  5. Hi, Obviously I'm new here, and fairly new to PHP - so far this book has been very helpful and usually easy to follow. I got the 3rd edition from the library and got through Chapter 10 before ordering the 4th edition when it came out. So now I'm just skimming back through the early chapters to see what's different. The calculator script is quite different, and I was wondering about the method of checking if the form has been submitted. The earlier version used a hidden form input and checked if the value was set, the new one checks if $_SERVER['REQUEST_METHOD'] is POST. What's the difference? Is that better or more secure? Does the hidden form input being visible in the HTML source have anything to do with it? BTW, I like your way of showing the tags in blocks. On a couple art websites I'm a member of it's often difficult to tell how tags are going to show up until the piece is posted - and that's important if you're trying to sell something!
×
×
  • Create New...