PHP file within a folder

Hello, when I use my contact form and it sends the email
I have a `if ($sucess) to go to a page and I have that .php file
in another folder titled “php” but when it goes to that page it
says page not found. is it that .php files cannot be in a folder?

// redirect to success page 
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=php/indexthanks.php#subscribe\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}

PHP files can be anywhere.
I take it you have a folder named php.
then you need a path. (same directory)

./php/indexthanks.php#subscribe

or (go up 1 directory)

../php/indexthanks.php#subscribe

BTW these are relative paths
absolute path from poot would be

/php/indexthanks.php#subscribe

best way to debug is to look at the URL, where are you?

it gives me this URL: http://impactograph.com/php/indexthanks.php#subscribe

and the page is without any style:

I have it like this:

if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=../php/indexthanks.php#subscribe\">";
}

you start out in the php directory then go up one directory and then go back to the php directory to find the thank you page.

what you want is …/indexthanks.php#subscribe (remove the jump back down to /php/)

Just go up a directory and display the thankyou page.

still does not work I did:

if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=/indexthanks.php#subscribe\">";
}

I get a 404 page

change to

URL=../indexthanks.php#subscribe

I still get an error

if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=../indexthanks.php#subscribe\">";
}

This is the HTML Form:

 <form id="subscribe" action="php/indexmaillistengine.php" method="post">
                <label id="mail_list">Join Our Mailing List</label>
                <input class="inside_search" type="text" name="YourFullname" placeholder=" Your Name" />
                <input class="inside_search" type="text" name="Youremail" placeholder=" Your Email" />
                <input class="searchButton_mail" type="submit" name="submit" value="Submit" />
           </form

This is the structure of my folders

Root: Index.html (there the form is), php folder (where the indexthanks.php is and indexmaillistengine.php is)

so I calling out the php folder.

your URL points to the wrong folder. your PHP files are not in the parent folder to your HTML file.

So I cant put php files in folders? why wont it direct there?
I think I know why because it needs to be within the same directory to
read stylesheets and such correct? I was treating these files like images folders
thinking it would work the same but it doesnt…

@Dormilich @lorenw Thanks for your help I have other ideas in mind to make this work for
all my pages.

../indexthanks.php#subscribe is just the wrong address.

right that file is in a folder titled “php” and regardless if it does read
it its without the stylesheet and other things so it wont work either way. I
would have to duplicate my styles and scripts to that folder and thats just too
cumbersome…

Your php folder is not where you think it is. If it was, then http://impactograph.com/php/indexthanks.php#subscribe would not return a 404

Where is the php in relation to the root? It must not be directly under the root.

http://impactograph.com/index.html works
http://impactograph.com/php/indexthanks.php returns a 404

it was like this

ROOT: index.html (form is there) php folder (php files there)

the folder is in the same root.
regardless if it did work I would need my other content within the ‘php’ folder
thats why it would not get any style. but thanks anyways guys. im trying a different approach.
I have all the php files in my root folder now and I deleted ‘php’ folder.

now its like this:

ROOT: index.html (form location), php files

Something’s not kosher because that file is NOT in

Are the permissions correct? Is there a case problem?

You might have a URL rewrite problem, because I can hit two completely different “404” pages. Not good…

These two are the same 404 page, but you’ve got relative paths on your style sheets (rarely a good idea)


Can you screenshot your root folder in your ftp application? From where index.html is…

Try this URL
http://impactograph.com/indexthanks.php#subscribe

indexthanks.php is in the root and not in the php folder

Yeah I know I moved it back I deleted that folder I
am doing a different approach thanks. :smiley:

Sure:

impactograph.com: (from impactograph folder)

iogproducts.com: (main root)

it seems like for the php errors it gives a 404 without style weird…but for the html
errors it gives the right 404 page…