CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Directing to another page

 



anujagarwal
Deleted

Mar 20, 2000, 10:49 PM

Post #1 of 6 (1476 views)
Directing to another page Can't Post

How can I direct a user to another page. For example: I verify the login info. in the if statement

if ($temp_ssn == $passwd) {
here, if the login is successful, I want the user to be directed to another page, lets say: http://www.espn.com
}
else {
dienice("Unsuccessful login. Please try again.");
}

If the login is successful, I don't want to show the user a link, rather i want him to be directed to another site automatically? How can I do this?

Thanks,
Anuj


Cure
User

Mar 21, 2000, 11:14 AM

Post #2 of 6 (1476 views)
Re: Directing to another page [In reply to] Can't Post

Hi

This will for you:


$url='http://www.espn.com';

if ($temp_ssn == $passwd) {

print "Location: $url\n\n";
}

else {

print "Unsuccessful login. Please try again.";

}


NOTE:: == is for Numeric values
eq is for string values


Cure


anujagarwal
Deleted

Mar 21, 2000, 11:36 AM

Post #3 of 6 (1476 views)
Re: Directing to another page [In reply to] Can't Post

I tried it, and this is what gets displayed if the user information is verified:

Location: http://www.espn.com

I'm still not directed to the site if my information is verified. The reason I'm trying this is because once I authenticate a user, I want to transfer control to another form. This form is resident on a palm, and I don't want my script to create it, rather just direct the user to it.

anuj



Cure
User

Mar 21, 2000, 11:47 AM

Post #4 of 6 (1476 views)
Re: Directing to another page [In reply to] Can't Post

Hi

The reason why your code is printing the link instead of directing you site the sepn site is because you have http header above the if statement-> you need to comment out the http header

example::this is your code and it will not work.


print "Content-type: text/html\n\n"; #(this is a http header, so this code will print the link and not direct you to the espn site.


$url='http://www.espn.com';

if ($temp_ssn == $passwd) {

print "Location: $url\n\n";
}

else {

print "Unsuccessful login. Please try again.";

}


Example: this is code will work for you because i dont have a http header above the if statment:

$url='http://www.espn.com';

if ($temp_ssn == $passwd) {

print "Location: $url\n\n";
}

else {

print "Unsuccessful login. Please try again.";

}


Cure



anujagarwal
Deleted

Mar 21, 2000, 12:40 PM

Post #5 of 6 (1476 views)
Re: Directing to another page [In reply to] Can't Post

Thanks, that worked.


Cure
User

Mar 21, 2000, 12:53 PM

Post #6 of 6 (1476 views)
Re: Directing to another page [In reply to] Can't Post

Your Welcome anujagarwal


Cure

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives