Below is the file structure of my website on the domain server (not localhost):
public_html
--- index.html
real-estate-website
--- resources
--- --- sign_up.php
I have a form in my index.html file that points to...
../real-estate-website/resources/sign_up.php
I have tried adding a ./ before this, but it made no difference. When I submit the form from my domain, I get a 404 error, with the following url in the address bar:
[domain-name]/real-estate-website/resources/sign_up.php
Is there an issue with where the form is pointing or am I overlooking something else? Any help is appreciated. Let me know if I should clarify any part of my question
Usually in a web hosting provider server, public_html is the folder where you put all your files that should be accessible to the users of your website (through a web browser), any file outside of this folder is not accessible directly from a web browser, unless you use some PHP code to deliver it in some way.
Here you are using an HTML form and using its action
attribute which should always point to an accessible file, ie a file inside public_html.
My suggestion is to move the folder real-estate-website with its content inside the public_html folder.
public_html
--- index.html
--- real-estate-website
--- --- resources
--- --- --- sign_up.php
And change the action
attribute value of the form to point to your desired file: /real-estate-website/resources/sign_up.php
.
UPDATE
Regarding the comments below what I meant with PHP include
is for example to create a PHP file outside public_html :
public_html
--- index.html
--- real-estate-website
--- --- resources
--- --- --- sign_up.php
config
--- settings.php
In settings.php you put the sensitive data:
<?php
const EMAIL_PWD = 'secret';
And in your sign_up.php include settings.php in the top of your code like this:
<?php
include __DIR__ . '/../config/settings.php';
So inside your sign_up.php code you should have access to the string constant EMAIL_PWD and use it accordingly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.