Caf26 Posted April 17, 2013 Share Posted April 17, 2013 I am new to php and want to add a form to my site to send am email to the owner on completion of the form, I have got the code but when I try to run it in chrome (through notepad++) I click submit but it show the php code rather than sending an email, is this a problem with the code or because it's not on a server and just tan through notepads run in chrome function Quote Link to comment Share on other sites More sharing options...
lemmin Posted April 17, 2013 Share Posted April 17, 2013 It is because it's not on a server. You need to have a webserver with PHP installed to parse the PHP code. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted April 17, 2013 Share Posted April 17, 2013 You'll need a web server with PHP installed, and access the page via it. PHP is a server-side scripting language, which means that it needs to be run on the server, before any content is sent to the client. Browsers does not understand PHP code, only HTML, CSS and JS. Which is why it's only showing you the code, as if the file was a pure text file (which it is, as far as the browser is concerned). For Windows you can download WAMP, which will install everything you need in one go. After you've done that, just move the files to the document root of the web server (htdocs), and then open the page via "localhost" in the browser. Quote Link to comment Share on other sites More sharing options...
Caf26 Posted April 17, 2013 Author Share Posted April 17, 2013 I have downloaded wamp but not had chance to use it yet ill look later and hopefully that will work thankyou Quote Link to comment Share on other sites More sharing options...
Caf26 Posted April 18, 2013 Author Share Posted April 18, 2013 I downloaded wamp and that has sorted the problem with showing the code, my form is fully functional apart from actually receiving the emails, I beta confirmation on screen saying Thankyou for submitting but do not receive the email, is this because its ran through wamp? Quote Link to comment Share on other sites More sharing options...
Christian F. Posted April 18, 2013 Share Posted April 18, 2013 Most likely, yes. To get it to send out e-mails you'll need either a mail server running on your computer, or PHP configured to use an external server. Neither are default. Quote Link to comment 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.