gammaman Posted April 4, 2008 Share Posted April 4, 2008 I have the following code, first off I should mention that I am trying to run it from the wamp server (localhost) because I only need to demo my form, not put it on a web server. So the first question is, can I do that. Second when I click send on the form, I get the dreaded "The page could not be dislpayed". WHY? The HTML Part: <html> <head> <style type ="text/css"> div#wrap{ margin:0 auto; width:400px; </style> <body> <div id="wrap"> <FORM METHOD = "post" action="http://localhost/sendmail.php"> First Name: <input type ="text" name="firstname"/>   <br/> Last Name: <input type ="text" name="lastname"/> <br/> <br/><dd/> Comments orSuggestions: <br/><dd/> <textarea name="comment" rows="10" cols="50"></textarea> </textarea> <br/>           <input type = "submit" value="send"> <input type = "reset" value="clear"> </form> </div> </body> </head> </html> The PHP part <?php $first = $_REQUEST['firstname']; $last = $_REQUEST['lastname']; $comment = $_REQUEST['comment']; mail("code.bro@verizon.net", "Comments/Suggestions", "From: $first,$last", "Comment:$comment"); header("Location:E:/Senior Project/cater.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/ Share on other sites More sharing options...
Yesideez Posted April 4, 2008 Share Posted April 4, 2008 I've never played with WAMP as all my work is done live online. Try changing the location of the script in the form action="" to an empty action: <form action="" method="post"> Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509178 Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 when using forms you don't need to use the entire url for the submital. just reference the file from where the current script is running. If sendmail.php is in the same folder as the current running script use. also is this all on the same page??? <FORM METHOD = "post" action="sendmail.php" /> Ray Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509179 Share on other sites More sharing options...
gammaman Posted April 4, 2008 Author Share Posted April 4, 2008 That is the problem, the sendmail.php is not in the same folder. Because I am trying to run it from the wamp server (localhost) it has to go into a special location which is C:\wamp\www. If you do not put the .php file in this location, it will not run. Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509181 Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 What are the names of the 2 files and where are they located?? Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509183 Share on other sites More sharing options...
gammaman Posted April 4, 2008 Author Share Posted April 4, 2008 The html page is called comment.html and the location is: E:\Project\ The php is called sendmail.php and is located in C:\wamp\www\ Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509188 Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 so pretty much you have a web server running on E:\ and then a local web server running in c:\wamp\www Is that right?? Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509191 Share on other sites More sharing options...
gammaman Posted April 4, 2008 Author Share Posted April 4, 2008 No, that is the point I am trying to make. There is no web server. The site contents are on E:\ All I am trying to do is demo the form to show that it works. It will NEVER be put onto a web server. The point of the wamp is to run php on your localhost. But I seem to be having a problem doing that. Someone in another forum mentioned having to set the wamp ini setting, but I have no idea what they were talking about Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509195 Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 easiest thing to do is move the project to the www folder. Save yourself a lot of headaches. Have you checked to make sure php is running fine, you can also change localhost to the ip address of the box instead. http://xxx.xxx.xxx.xxx/sendmail.php Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509204 Share on other sites More sharing options...
gammaman Posted April 4, 2008 Author Share Posted April 4, 2008 Well I actually just tried moving the comment.html file to C:\wamp\www and when I clicked send, it still said the sendmail.php could not be displayed Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509205 Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 Well first off you have nothing that is outputting on the screen, second your header location is pointing to a place outside of WAMP. Your web server will only work inside www. if you want put a check in <?php $first = $_REQUEST['firstname']; $last = $_REQUEST['lastname']; $comment = $_REQUEST['comment']; if(!mail("code.bro@verizon.net", "Comments/Suggestions","From: $first,$last", "Comment:$comment")){ echo "Mail could not be sent"; } else { header("Location:E:/Senior Project/cater.html"); } ?> You sould also change E:/Senior Project/cater.html to a page within the web server (www) Ray Quote Link to comment https://forums.phpfreaks.com/topic/99534-question-about-code-and-wamp-server/#findComment-509208 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.