.php page can't be found during form-ajax-submit

Hi all,

I am trying to do my first form POST with F7 using:

<form action="pages/form-data.php" method="POST" class="form-ajax-submit">

If I change the action to a URL such as https://postman-echo.com/post then it is successful. However the error event keeps getting triggered when I try use my own php page as the action as it cannot be found.

image

What am I doing wrong?

You need a worker PHP server for it work correctly

Ok so my F7 code is correct then. Will it be able to work correctly if I have PhpmyAdmin running as localhost?

404 errors indicate that the path of the page is wrong or that there is no page to say. Review your base_url address and directory structure. If you can access the url address from the browser, you are successful.

https://stackoverflow.com/questions/2820723/how-do-i-get-the-base-url-with-php

That’s the issue I am having… I don’t know if it is giving the error because it can’t actually find the php file, or if the error is being caused by an issue inside the php file and/or incorrect server?

Just click that url and see what happens in your browser window. If you get a 404, then the url is invalid.

If you were getting a 500, or some other error code, then you would say there is an issue with the php code.

If I click the URL in the console then it downloads the correct php file to my PC… so the URL must be right then?

No. When you click a php url, it should not download the php file to your pc. It should instead run the php file on the server. Unless the purpose of the php file is to download itself to the pc?

Either the php server is not running, or has a configuration issue. But downloading the php file is not normal behavior.

Ok great thank you for your help. I was making the mistake of trying to run the php file from inside my www folder (Phonegap) and not on the local server. I updated the html and the form data is now being successfully sent to the local database.

<form action="http://localhost/scripts/form-data.php" method="POST" class="form-ajax-submit">

Thanks everyone for your advice/input.