issue with html and PHP

PHP file not found when called in an html form

Page 1 of 1

5 Replies - 992 Views - Last Post: 28 April 2010 - 10:27 PM Rate Topic: -----

#1 jptenney  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 28-April 10

issue with html and PHP

Posted 28 April 2010 - 02:34 PM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: issue with html and PHP

#2 Scotty G  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 59
  • Joined: 09-April 10

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. :smile2:
Was This Post Helpful? 0
  • +
  • -

#3 atik97  Icon User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

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.
Was This Post Helpful? 0
  • +
  • -

#4 jptenney  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 28-April 10

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.
Was This Post Helpful? 0
  • +
  • -

#5 b2rana  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 25-April 10

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
<form action="abc.php" method="post">

Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

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?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1