can somebody tell me why when i use a link on <form action="http://www.mysite.com/login.php" method="POST"> the login script won't work :(

first i used only action="login.php" but now i need to use the link because i want other login forms on diferent pages (directory) like http://www.mysite.com/news/
and i can't put on every directory the script login.php !

in IE works fine but in netscape firefox or chrome sometimes don't work i don't know why in firefox without the www. works better :| i made a javascript to change the action="" link but don't work for some users..

ps: all the datas are get in php from $_POST

any suggestion?! thanks :)

Recommended Answers

<form action='/login.php' method='post'> relative link on your site work?

Jump to Post

subdomain persistence cookes: try: http://www.15seconds.com/issue/971108.htm

Jump to Post

just the format of the code to put in the cookie too leave off the www and make the cookie refer to .mysite. let me open up my notes, probably the next link is the php one

edit: yep, subdomain cookies at

Jump to Post

All 12 Replies

<form action='/login.php' method='post'> relative link on your site work?

thanks for your reply almosbob

in this case don't work.. i have diferent problems with firefox and google chrome.. when i use subdomains to make links shorter the login session is gone and the users in that page is not loged in.. my (session remember) in php is based on "cookies" in IE works fine..

how can i make cookie works for subdomains to like http://sub.mysite.com/ ? (ps: on http://mysite.com/sub/ works) maybe this is the problem for my login script..

infomation that wasnt in the first post,
sub1.mysite.com and sub2.mysite.com have the same path from the server root so
try <form action='<?php echo $_SERVER['DOCUMENT_ROOT'];?>/login.php' method='post'> if sub1.mysite.com is directed to www.mysite.com/subfolder1/subfolder2 then relative links ..(up one) will work even if they lead above the root of the subdomain <form action='../../login.php' method='post'> (demo: up two) it may be enough to count the folders back to the www root

both methods work, the first one on a site where subdomains all point to folders one level below the wwww root(planned in advance), the second on a site where the original work was built (hashed together) over years and many generations of code, (and is still patched when problems occur instead of being rewritten properly(aarrrgh time there is never enuf))

in chrome works with /login.php , yes omol but using / is better cz it goes to the site root directory where is located login.php , damm this browsers we need to work on each browser to make a website run... in firefox don't want to work...

good ideea bob, but i have a problem browsers don't get the login cookie for subdomains so if i login on www.site.com on sub1.site.com i'm not logged! i don't know why :)

done! deleted all cookies and now works in firefox too.. sims to be a "cookie" problem, now i need to discover why on subdomains don't work for example if i go to http://news.site.com i'm not loged in. on http://site.com/news the user is loged..

thanks for the link bob but asp is not an options for me cz i don't know it, other ppl said i have a problem with php cz there is an option to save cookie for all entire website subdomains too.. but why in IE works :-?? if i don't used that option.

i need to search that cookie share script in javascript.. jquery .. or php, thanks again

just the format of the code to put in the cookie too leave off the www and make the cookie refer to .mysite. let me open up my notes, probably the next link is the php one

edit: yep, subdomain cookies at php.net http://php.net/manual/en/function.setcookie.php

The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you'd set it to '.example.com'. The . is not required but makes it compatible with more browsers. Setting it to www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the ยป spec for details

in 'parameters' at the top of the page

commented: Compasation for previous mistake +14

solved!!! thanks a lot bob & omol your post was very usefull! and yes the php was bad coded :D i set that option and now works fine. have a nice day, night, boys.

not bad, just drawn that way :jessica_rabbit:
a learning experience,
learn from mistakes, we have already learnt have therefore made more mistakes,
NOT the best way to build an Abomb though, Dos V'danye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.