Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. I think we're not quite following each other here. Let's look at this logically... 1. header.html uses if (isset($page_title)) { so $page_title MUST be set in the file that includes the header and before the header is included. 2. The code you posted above does exactly that, which is great. $page_title = $words['signin']; 3. That code only works if $words is defined. There's nothing in the code you've posted that defines $words. Does your config.inc.php or MYSQL script do that? Again, this is a pretty basic logic issue and you may find that if you talk it out you might realize where the problem is.
  2. Do you make sure that the $words variable is populated before the header file is included?
  3. Sorry for the confusion! The fourth edition of the book had a Chapter 18. This one does not, but I kept the code (as an Easter Egg!) in just in case.
  4. Ah, thanks for explaining. Unfortunately I'm not a pro-debugger when it comes to Bootstrap (or CSS) so it's not obvious to me what the cause is. In such situations I'd normally find a working example some place, copy that in, and then replace the key bit with my PHP code.
  5. Ah, okay, so that would mean the $words array, which presumably comes from the database query, has no 'signup' element, which means there's no such column in the database.
  6. How is the code you're currently using not working? What debugging steps have you taken and what were the results?
  7. You need to ensure that every page that includes header.html sets a $page_title variable.
  8. Good question! The main reason is the logic would be really complicated and prone to have bugs. It definitely not an approach I'd recommend for beginners. If anything on a more advanced level, I might be inclined to make it more modular: for example, put the form and form validation in one or two separate pages then included by the primary pages. Thanks for the great question!
  9. It's not clear to me what function you're referring to, but I'm pretty certain the answer would be "no". The easiest way to clear the contents of a text file would be to delete the text file and then recreate it.
  10. Yep! After the loop, $book refers to the last item in the $books array. That should not be the case! I wouldn't think it'd be the case, anyway. Just to be clear, you may want to add headings before doing each print_r() so it's absolutely clear what's going on. It should print the last key, yes, but that value should not be a book. Yes, that should be correct. Aside from a bit of confusion, in general, the last value assigned to a variable in the loop is still assigned to that variable after the loop, which is what you're seeing here.
  11. Hmmm...that is strange. My best guess is there's a tag missing in the HTML? B/c some CSS is working properly (the most common problem would be a failure to load the CSS entirely).
  12. Yes, it looks like your site doesn't include those JavaScript links. I don't know if that's a problem or not (it is a problem if your site needs that JavaScript). But it's pretty unusual to pull a JS file from another site.
  13. It's with the other downloadable code: https://github.com/LarryUllman/phpmysqlvqp-5ed/tree/master/ch03/css
  14. If I try to load http://www.the-tree-of-life.com/lib/jquery/jquery.js directly in my browser I get a 404. Same for the core.js script. It looks like those files have been moved. You should talk to whomever gave you those links to use to find out what links you should use now instead.
  15. I'm not entirely sure I follow what's going on or being asked here, but... 4. I don't know what it means to "call from an HTML file". You can load any HTML file anywhere in a browser but to run an HTML file through a URL, it has to be within Apache's document root. An HTML file cannot include a PHP script. 5. That sounds like you're observing a file transfer session, where they've logged into a remote server and then they drag-and-drop to transfer files. Apache, HTML, and PHP don't come into play here (i.e., you can file transfer any type of file). 6. That is correct. 7. Again, not sure what "call HTML" means but if you're using the web server application (e.g., Apache), to load a file through a URL it has to be in the web server document root.
  16. Hmm...this isn't obvious to me. A guess is that "c" vs. "C" may be a problem, but that's just a blind guess. I have no idea if that's a problem for Windows or not. My second guess is that initial space in the file name is causing a problem. Make sure that move_uploaded_file() code is on one line.
  17. That looks like it would work! Use an invalid username or password so the connection fails to confirm.
  18. Ugh. Is that in a Kindle or other version? Because, yes, those should look different (city, City, and CITY?). So sorry about that!
  19. Yep! Per http://php.net/manual/en/fileinfo.installation.php (I assume you're using Windows.)
  20. Cool! This is why I always recommend to start by confirming the session ID to ensure it's not changing. That's the #1 cause of session problems in my experience. Glad it's working!
  21. Ah, that totally makes sense! Because the subdomain was changing (from www. example.com to example.com), the session cookie wasn't available. This means a new session would be started each time and you'd lose access to the previously stored data.
  22. Sorry you didn't resolve the mysterious cause but I'm glad you figured it out and thanks for letting us know!
×
×
  • Create New...