Jump to content

[SOLVED] problem with HTML/PHP form on Apache


aldm

Recommended Posts

Hi,

I have Apache server installed on my computer and I'm learning PHP. I have a HTML form with following code:

<html>

<head>

  <title>Forma</title>

</head>

<body>

<form action="F:\xampp\htdocs\phpinfo.php" method="POST">

<br>Unesite tekst:

<br><input type="text" name="podatak" value="">

<br><input type="submit" name="submit" value="Posalji">

</form>

</body>

</html>

Code of phpinfo.php file:

<?php

phpinfo();

?>

When I click on "Posalji" button, firefox gives me next alert:

Firefox doesn't know how to open this address, because the protocol (f) isn't associated with any program.

Has anyone idea how could I solve this problem?

Thanks in advance :D

I save both files (forma.html and phpinfo.php) in F:\xampp\htdocs and action is "phpinfo.php".

When I type localhost/phpinfo.php in my browser, it works, but with click on button, it doesn't works. It shows me

a blank page with adress: file:///F:/xampp/htdocs/phpinfo.php

That because the form action needs to be

<form action="phpinfo.php" method="POST">

 

Now to run your form open your browser and go to http://localhost/forma.html

 

Do not double click your files from within Windows Explorer to open in your browser. You must go to http://localhost to run your html/php files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.