Hello
I have an html form that I created that calls for a php script. The form works fine. Except when I submit it the php script cannot be found. This is all done on a local machine. Both files are in my httpdocs folder which is where my apache server points to. I have checked the code to make sure my php script name and the file called are the same. I believe it to be something to do with needing to use http://localhost/script.php in the browser in order to run. My concern is does my html code need to do that some how. Isn't there a way to make my windows machine run the php script simply by double-clicking the php file? I think that is what needs to happen.
issue with html and PHPPHP file not found when called in an html form
Page 1 of 1
5 Replies - 683 Views - Last Post: 28 April 2010 - 10:27 PM
Replies To: issue with html and PHP
#2
Re: issue with html and PHP
Posted 28 April 2010 - 03:07 PM
Hello there,
I'm not really following you. You should be trying to submit your form variables to the page that has the php script. If you show me some code I might be able to explain a little clearer.
I'm not really following you. You should be trying to submit your form variables to the page that has the php script. If you show me some code I might be able to explain a little clearer.
#3
Re: issue with html and PHP
Posted 28 April 2010 - 07:27 PM
You need to put your php files in document root folder, that is in htdocs folder in your local machine. Then if you have a script named sample.php, you can access it http://localhost/sample.php.
So first make sure you upload both your files in document root and set the action attribute of <form> tag to correct php file. Then in php file use the appropriate method which you have used in the method attribute of <form> tag to access form fields. Hope it make sense.
If you still face problem, then consider posting code here for getting better help.
So first make sure you upload both your files in document root and set the action attribute of <form> tag to correct php file. Then in php file use the appropriate method which you have used in the method attribute of <form> tag to access form fields. Hope it make sense.
If you still face problem, then consider posting code here for getting better help.
#4
Re: issue with html and PHP
Posted 28 April 2010 - 09:21 PM
Thanks for all your advice, but I've already have what you all suggest. Here is the problem I had. My doc directory is in httpdocs folder and that is how I configured apache. What I was doing was double-clicking my html file. It would run fine, but the php file could not be found. Apparently not looking at the localhost. For S & Gs I thought what if I opened up a browser and enter http://localhost/htmlfile.html. Bingo my php was found but died do to syntax. But that is another story.
#5
Re: issue with html and PHP
Posted 28 April 2010 - 10:14 PM
If both html and php file are on same path.
The code in html files should be
The code in html files should be
<form action="abc.php" method="post">
#6
Re: issue with html and PHP
Posted 28 April 2010 - 10:27 PM
One question I haven't seen asked yet, you do have PHP installed, right?
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|