php page direction problem.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
darkstarskaterboy
Forum Newbie
Posts: 5
Joined: Tue May 31, 2005 12:00 am
Location: Pa

php page direction problem.

Post by darkstarskaterboy »

I have a login page that i use and it is in php and i can't figure out how to make the page go to the house.php page when you click login. I was wondering if anyone would be able to help me out.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

<form action=&quote;house.php&quote; method=&quote;post&quote;>
<input type=&quote;textbox&quote; name=&quote;usr&quote; value=&quote;USR NAME&quote;/><br />
<input type=&quote;password&quote; name=&quote;pwd&quote; value=&quote;URE PASS&quote;/><br />
<input type&quote;submit&quote; name=&quote;login&quote; value=&quote;Proceed&quote;/>
</form>
When clicking on that proceed button it will jump to house.php
Fetch it with $_POST or $_REQUEST
darkstarskaterboy
Forum Newbie
Posts: 5
Joined: Tue May 31, 2005 12:00 am
Location: Pa

already used

Post by darkstarskaterboy »

the form action is already used. <form action=\"$PHP_SELF\">.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

The either change that or perhaps use header()?
ashi2005
Forum Newbie
Posts: 1
Joined: Tue May 31, 2005 12:34 pm
Location: New York
Contact:

Post by ashi2005 »

You need to just type the HTML command Target as follows

<form action="house.php" method="post" TARGET = " _house.php">
<input type="textbox" name="usr" value="USR NAME"/><br />
<input type="password" name="pwd" value="URE PASS"/><br />
<input type"submit" name="login" value="Proceed"/>
</form>
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

darkstarskaterboy
echo '<form action=".'$_SERVER['PHP_SELF'].'">';
though direct html should work

ashi2005 : TARGET is deprecated in all tags
smo
Forum Newbie
Posts: 20
Joined: Tue May 31, 2005 11:02 pm

Post by smo »

Using header redirect is better here. The form can be submitted to check the login status, if successful then redirect to a welcome page or house page. Otherwise send to re-login page with error message.

This will also help in page expired problem.
darkstarskaterboy
Forum Newbie
Posts: 5
Joined: Tue May 31, 2005 12:00 am
Location: Pa

Header redirect

Post by darkstarskaterboy »

I think that was what i was trying to do. My index page contained the frame info for the rest of my site while i have index being a php file with the 'include login.php', that is what i was trying to do, but it didn't work for me.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

smo wrote:Using header redirect is better here. The form can be submitted to check the login status, if successful then redirect to a welcome page or house page. Otherwise send to re-login page with error message.
you're probably going to want to submit the form as ol4 suggested, then if the credentials check out ok against the db or wherever you're storing your user info, use header() to relocate them, or JS or a meta tag...

you only want to use those AFTER you've submitted the form however and checked they are a valid user.
smo
Forum Newbie
Posts: 20
Joined: Tue May 31, 2005 11:02 pm

Re: Header redirect

Post by smo »

darkstarskaterboy wrote:I think that was what i was trying to do. My index page contained the frame info for the rest of my site while i have index being a php file with the 'include login.php', that is what i was trying to do, but it didn't work for me.
Here since you are including the login.php file, inside that login.php file with a if condition check the session exists or not ( to know the member is logged in or not ). If not existed then show the login window ( login form) and if exists then give a welcome message with a logout button. Like "Welcome john" | Logout .

If some one is not logged in then with the entry of id and password, on submit, take them to one page where you can check the id and password and if found correct then start the session and redirect the browser to home page. Now as the session is logged in so the member will get welcome message with a logout link.
http://www.plus2net.com/php_tutorial/ph ... logout.php
Post Reply