Page 1 of 1
Return to Home Page????
Posted: Mon Aug 16, 2010 12:10 pm
by SamCec
I am new to PHP and trying to learn enough to help me with my web site. I have several pages on my site defined as follows:
These were written using HTML:
Home page = WoodArt.shtml
OrderForm page = Form.html
PHP code page = Test.php
This is what's happening: On the ORDERFORM page when I click the SUBMIT button, the PHP code page is called and executed. When the execution is complete, I have a blank page on my screen. I would like to have it automatically return to the HOME page. Can someone explain to me and show me the code I need to do this?
Thank you,
Sam
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 12:38 pm
by AbraCadaver
Code: Select all
header('Location: example.com/WoodArt.shtml');
exit;
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 12:42 pm
by liamallan
put this in the end of ur code:
Code: Select all
header("Location: ../woodarts.html");
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 2:18 pm
by AbraCadaver
liamallan wrote:put this in the end of ur code:
Code: Select all
header("Location: ../woodarts.html");
No, don't do that. Location headers require a absolute URL (though they may work without one) and why the ../?
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 2:31 pm
by SamCec
Everyone: Thank you for your suggestions but using that code, I could not get it to work. I did add this code to the bottom of my PHP code and finally got it to work.
Code: Select all
<meta http-equiv="refresh" content="0;url=WoodArt.shtml" />
Thanks Again,
Sam
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 2:38 pm
by liamallan
i use the ../ to take me back to the root folder in case the processing file is in its own directory
Re: Return to Home Page????
Posted: Mon Aug 16, 2010 2:42 pm
by AbraCadaver
liamallan wrote:i use the ../ to take me back to the root folder in case the processing file is in its own directory
Suppose it's 2 directories deep

Re: Return to Home Page????
Posted: Mon Aug 16, 2010 2:46 pm
by liamallan
works if its 3,4,5,6 or 7 directories deep.
infact u can have as many directories as u want

Re: Return to Home Page????
Posted: Mon Aug 16, 2010 3:09 pm
by AbraCadaver
liamallan wrote:works if its 3,4,5,6 or 7 directories deep.
infact u can have as many directories as u want

What?
http://www.example.com/index.php is the home page.
http://www.example.com/content/products/index.php contains this code:
Will not take you to the first URL, you would need to use ../../ which is very confusing to use many different relative paths in many pages when simply using
http://www.example.com/index.php in any page works as intended.
