HMRC Posted April 6, 2009 Share Posted April 6, 2009 Im a novice and I want to develop a small Web based database system and so I have installed Wampserver. I have written my html forms and php files using notepad. The html form is suppossed to load a php file but apperantly instead of executing the php file, the php file is being downloaded as a document as opposed to running it. Here is my code. CreateAccount.php <?Php include('ServerAndDbConnect.php'); $First_Name = $_POST["firstName"]; $Last_Name = $_POST["lastName"]; etc ServerAndDbConnect.php <?php $hostName = "localhost"; // Host name $dbName = "StockControl"; // Database name $userName = "root"; // Mysql username. $password = ""; // Mysql password mysql_connect("$hostName","$userName","$password") or die ("Can't log in either username or password is incorrect"); mysql_select_db("$dbName") or die ("Failed to open database or database doesn't exist"); ?> When I hit the submit button on my form it is supposed to run "CreateAccount.php" but instead opens it in text form. Is there special folder am supposed to place the files or what. Please take me thru step by step Thankyou HMRC Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/ Share on other sites More sharing options...
Mchl Posted April 6, 2009 Share Posted April 6, 2009 Put your html and php files in c:\wamp\www (or it's subfolders) Then point your browser to http://localhost/ Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-802589 Share on other sites More sharing options...
HMRC Posted April 7, 2009 Author Share Posted April 7, 2009 Ok, I have put my files in the following folder C:\wamp\www\StockControl Im using internet explorer but I guess now I don't know how to point my browser to this folder because it's still opening them as text documents Thanks Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-803215 Share on other sites More sharing options...
trq Posted April 7, 2009 Share Posted April 7, 2009 What url are you accessing the files via? Should be.... http://localhost/StockControl Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-803232 Share on other sites More sharing options...
HMRC Posted April 7, 2009 Author Share Posted April 7, 2009 When I execute the html file what I have is C:\wamp\www\StockControl\StockIssue.htm My biggest problem is where and how do I specify that it should read http://localhost/StockControl Wampserver is on and all services are running. Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-803246 Share on other sites More sharing options...
trq Posted April 7, 2009 Share Posted April 7, 2009 You put http://localhost/StockControl in the address bar of your browser, just as you would any website. http://localhost points to your local webserver. Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-803255 Share on other sites More sharing options...
HMRC Posted April 7, 2009 Author Share Posted April 7, 2009 Thanks a lot, problem solved. Its nice to be a novice!!! Quote Link to comment https://forums.phpfreaks.com/topic/152836-executing-php-files-with-wampserver-urgent/#findComment-803289 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.