FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Form Action relative address problem





DoctorBeaver
I've got all my pages in a subdirectory. When I click on the submit button on my forms it tries to load the next page from the root directory and, of course, can't find it. The only way I can it to work is by putting the absolute address in the "action" field.
cafefort
by the root directory you mean the root of your hosting?
Outside the public_html directory?
If it's the case, then it's natural that you can't access it by relative path.
Because the "root" directory for the webserver is "public_html"

Is it what you meant?

Hope this helps Smile
DoctorBeaver
cafefort - sorry, I should have been more specific.

I'm developing on my PC at home under JSAS.

When addressing my pages in the browser I use
http://localhost:85/beaverlandv4/pagename.php

The form tries to load from http://programname.php

All the pages are in the same directory (beaverlandv4) so for the "action" I specify simply pagename.php
Nyizsa
Try using
Code:
action="./beaverlandv4/pagename.php"


This may help.
DoctorBeaver
Thanks Nyizsa. I had considered that, but I really want to get the relative addressing working if possible. Relative has worked fine whenever I've used it with HTML forms on HTML pages. I don't know whether this being a Javascript form on an HTML/php page makes any difference.
AftershockVibe
I should work... you haven't stuck an extra / in there have you?

as in "/page.php" instead of "page.php"?
DoctorBeaver
Aftershock - No, I haven't. That was the 1st thing I checked.

It's not stopping me from developing my site, it's just an annoying little nag that I can't figure out a reason for and causes me a bit more work.
asiddle423
is the page in the same directory if so then if you use
Code:
 action = "./pagename.php"


this is the code i use for pages in the same directory as to when i dont put a DOT in front of the forward slash it doesn't seem to point me to my page.
cafefort
Hi doc,

Quote:
When addressing my pages in the browser I use
http://localhost:85/beaverlandv4/pagename.php

The form tries to load from http://programname.php


you mean: http://localhost:85/beaverland4/programname.php ? isn't it?

Have you tried

Code:
action="../pagename.php"


That should work Smile

P.S. A little bit curious: why don't you just put programname.php in the
/beaverland4 directory?
DoctorBeaver
asiddle423 wrote:
is the page in the same directory if so then if you use
Code:
 action = "./pagename.php"


this is the code i use for pages in the same directory as to when i dont put a DOT in front of the forward slash it doesn't seem to point me to my page.


Thanks. I never thought of doing that. D'OH @ me! Embarassed
asiddle423
glad to help

we all forget the smallest and easiest bits of coding
Related topics
HTML + PHP problem
Php form.
Form Mailer
Form and PHP problem
E-Cards with PHP & MySQL
PHP: Feedback form issues.. help =P
A PHP problem !
A php problem
PHP Login Problem
question : how to make a form on dreamweaver?
HTML Forms Problem
[resolved] Valid form
problem with cgi perl script
phpNuke Register new users Problem Problem
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.