scottdg Posted September 11, 2011 Share Posted September 11, 2011 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 Link to comment Share on other sites More sharing options...
Jonathon Posted September 11, 2011 Share Posted September 11, 2011 Hi Scott, What is your actual code your using? Secondly, I don't have the book so bare with me, can you run php ok on your local server, i.e build a small test page like test.php <?php echo 'Hello Scott'; ?> does that echo out the correct page, if not what do you get? Also you're loading feedback.html, should this perhaps be feedback.php instead? Also when you say it doesn't work, how doesn't it work and what do you see? Link to comment Share on other sites More sharing options...
scottdg Posted September 11, 2011 Author Share Posted September 11, 2011 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. Hi Scott, What is your actual code your using? Secondly, I don't have the book so bare with me, can you run php ok on your local server, i.e build a small test page like test.php <?php echo 'Hello Scott'; ?> does that echo out the correct page, if not what do you get? Also you're loading feedback.html, should this perhaps be feedback.php instead? Also when you say it doesn't work, how doesn't it work and what do you see? Link to comment Share on other sites More sharing options...
Larry Posted September 12, 2011 Share Posted September 12, 2011 If you're loading the HTML form through the file system, not through a URL, then the PHP script will never be executed. This is why I stress, heavily, that you must always use HTTP://something. What URL did you use to run PHP scripts in earlier chapters? Link to comment Share on other sites More sharing options...
scottdg Posted September 12, 2011 Author Share Posted September 12, 2011 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. Link to comment Share on other sites More sharing options...
Larry Posted September 12, 2011 Share Posted September 12, 2011 Yeah, the file path won't work either. The browser address MUST begin with http://. The "something" part then is the hostname, folder name, and script name. What those are depends upon the OS in use, the Web server in use, the specific script, and so forth. To repeat the question I asked in my last post, what URL did you use to run PHP scripts in earlier chapters? Link to comment Share on other sites More sharing options...
scottdg Posted September 13, 2011 Author Share Posted September 13, 2011 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. Link to comment Share on other sites More sharing options...
Larry Posted September 13, 2011 Share Posted September 13, 2011 In your last post you referred to feedback.html, which is the page you're having a problem with. What I'm saying is, presumably you went through the first two chapters, correct? And presumably you were able to execute those PHP scripts, correct? So, for example, when you successfully ran predefined.php from Chapter 2, what URL did you use for that? So could you please post the complete URL of a specific script from a previous chapter that you were able to execute? Link to comment Share on other sites More sharing options...
scottdg Posted September 13, 2011 Author Share Posted September 13, 2011 I forgot to mention it is windows 7 and I am using apache. Link to comment Share on other sites More sharing options...
scottdg Posted September 13, 2011 Author Share Posted September 13, 2011 I figured it out. Link to comment Share on other sites More sharing options...
Larry Posted September 13, 2011 Share Posted September 13, 2011 For the benefit of others, could you please share what the problem and solution were? Link to comment Share on other sites More sharing options...
Lou Posted September 13, 2011 Share Posted September 13, 2011 Did you use single quotes? Use double quotes to get the value. Link to comment Share on other sites More sharing options...
scottdg Posted September 17, 2011 Author Share Posted September 17, 2011 "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 Link to comment Share on other sites More sharing options...
Recommended Posts