Nate Posted April 25, 2012 Share Posted April 25, 2012 HI all, I am in chapter six at the end when we are building the FOR loop. I am having a problem with netbeans rendering the php in the html. Is anyone else having this problem. I have tried the following, I have restarted Netbeans. I have commented out the section and retyped it. I have copied another php section from handle_reg.php and it does not render either. I have cut out the php script, saved, restarted netbeans, and retyped the script. I have gone character by character comparing syntax with the book, everything is as the book has it. here is the code I am writing. <p>Date of Birth: <select name="month"> <option value="">Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day"> <option value="">Day</option> <?php <--this is marked in Netbeans as a misspelled word. Also this whole section is not color coded as other php scripts in the same project are. for ($i = 1; $i <= 31; $i++) { print "<option value=\"$i\">$i</option>\n"; } ?> </select> <input type="text" name="year" value="YYYY" size="4"/> </p> When I run this in the browser (chrome latest version) the drop down only shows "Day" as an option, When I copy the Select statement in question to handle_reg.php and run it in the browser it rruns just fine i see a drop down with 31 numbers. Is there a setting in netbeans that is not allowing php to render inside html? I don't think so because it works in every other page? I am stumped! Any ideas? Link to comment Share on other sites More sharing options...
Paul Swanson Posted April 25, 2012 Share Posted April 25, 2012 Is it possible the <?php tag is within a heredoc block? It would be considered regular text/html then. 1 Link to comment Share on other sites More sharing options...
Paul Swanson Posted April 25, 2012 Share Posted April 25, 2012 Are you sure you posted this in the right forum? I just scanned Chapter 6 for PHP and MySQL 4th Edition and there are no PHP scripts in chapter 6 ... it's all about MySQL. Link to comment Share on other sites More sharing options...
HartleySan Posted April 26, 2012 Share Posted April 26, 2012 Never used Netbeans before. Is that a virtual server package like XAMPP? If so, are you running the script from your localhost with the server running? Is the extension on the file .php, not .htm or .html? Link to comment Share on other sites More sharing options...
Nate Posted April 26, 2012 Author Share Posted April 26, 2012 I just figured it out. Its a stupid N00B mistake. In Netbeans if you open a new file under your current project you have some base option including a php file or a blank php web page. all of the html files in the book need to be built a a "PHP Web Page" NOT an HTML or XHTML page. Netbeans makes all the code highlighting and php interpretations based on that initial configuration.I really like Netbeans nice configurations, code highlighting, and code completion, but some of the initial configuration for new files can be skipped over too easily. I just need to slow down ad read the initial config options more carefully. I hope this helps others. Link to comment Share on other sites More sharing options...
Paul Swanson Posted April 26, 2012 Share Posted April 26, 2012 Ahh, that makes sense. I use the Netbeans IDE, too, and really like it except for the Code Hints always popping up too soon and getting in my way. Nate, has that been an issue for you? Maybe something is messed up in my configuration. 1 Link to comment Share on other sites More sharing options...
HartleySan Posted April 26, 2012 Share Posted April 26, 2012 If all you want is a glorified text editor with colored code, etc., you might want to check out a free text editor like Notepad++. I prefer Notepad2 for WIndows. Link to comment Share on other sites More sharing options...
Antonio Conte Posted April 29, 2012 Share Posted April 29, 2012 Ahh, that makes sense. I use the Netbeans IDE, too, and really like it except for the Code Hints always popping up too soon and getting in my way. Nate, has that been an issue for you? Maybe something is messed up in my configuration. Yeah, really hate that too. I prefer Eclipse for PHP. I don't know why, I just do. For Java, I need NetBeans because the debugger is so awesome. You can stop execution at given points and look at what the objects are storing and look at the methods calls. I had this assignment where we should write a validator for Xhtml. Because you need to figure out "the state" of code, a large switch statements who called the next method. We had to do this char-for-char to figure out what kind of tag it was and whether it was valid or not. No way I would've found my bug without NetBeans! Don't know if you can do something like that in PHP, but at least we have print_r() and var_dump(). 1 Link to comment Share on other sites More sharing options...
Recommended Posts