Jump to content
Larry Ullman's Book Forums

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 year later...
 Share

×
×
  • Create New...