home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Redirecting after login?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2097
Discussions: 200,948, Posts: 2,379,384, Members: 246,309
Old July 6th, 2003, 02:43 AM   Digg it!   #1 (permalink)
Senior Member
 
LittleKing's Avatar
 
Join Date: Oct 2001
Location: Chattanooga, TN
Posts: 660
Send a message via Yahoo to LittleKing
Redirecting after login?

I have a form in PHP that I want to redirect after successfull input.

Here is how the form is currectly working, or at least how I understand it.

The form has several fields and two are required. When the user hits submit, the page loads itself. It then checks and validates the required fields are met. If not it prompts the user for the missing field.

If it is correct, it performs a mySQL INSERT. Then returnsto the same form.


My question is after a successful input how can I tell it to forward/redirect to another page?

I'm not sure if this is enough info, but I can provide more if necessary.

Thanks,
LK
LittleKing is offline   Reply With Quote
Old July 6th, 2003, 02:59 AM     #2 (permalink)
Senior Member
 
LittleKing's Avatar
 
Join Date: Oct 2001
Location: Chattanooga, TN
Posts: 660
Send a message via Yahoo to LittleKing
I found the header() function, but I don't think it would work because the code for the update is after the headers have been outputted (I don't think that's a work).

Does anyone have an idea?

LK

(Just came up with an idea, I'm going to put the PHP code at the very top of the page, I don't think that will mess anything up.
LittleKing is offline   Reply With Quote
Old July 6th, 2003, 12:14 PM     #3 (permalink)
Senior Member
 
LittleKing's Avatar
 
Join Date: Oct 2001
Location: Chattanooga, TN
Posts: 660
Send a message via Yahoo to LittleKing
Well, I guess it did work. Since I am using dreamweaver and templates I didn't think I could put the code at the top of the page, but apparently I can.

And it work. The only problem is that the url doesn't change it keeps the same page. It's not that big of a deal, but it reposts the same info if they refresh.

LK
__________________
Want a portrait, drawing, mural or any other custom art? Contact my wife Mindy Herman @ -http://www.mindyherman.com/
LittleKing is offline   Reply With Quote
Old July 6th, 2003, 10:41 PM     #4 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
I have a form in PHP that I want to redirect after successfull input... I found the header() function... The only problem is that the url doesn't change it keeps the same page.

you can have the PHP script perform all you want without 'redirect's using header(). Not good to use after any PHP output, as you see with the url/post issue (not real redirect!).

try:

if ($firsttime)
{ //show form
}
else if ($formsubmit)
{ //check required
if ($goodinput)
{ //show results
}else
{ // prompts the user for the missing field
}
===

If you want to change the url for '$goodinput' but not the other stuff, you can(couple, if not a few ways), but you might want to rethink the flow of events/scripts.
qball is offline   Reply With Quote
Old July 8th, 2003, 02:23 PM     #5 (permalink)
Senior Member
 
LittleKing's Avatar
 
Join Date: Oct 2001
Location: Chattanooga, TN
Posts: 660
Send a message via Yahoo to LittleKing
Good point, I was using two different pages to perform this task, but I could put it into one page.

The only the the second page did was show the results from the db.

I'll give it a try.

Thanks,
LK
LittleKing is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Making Health Care Worse (169)
The disrespect of Obama by Russian .. (20)
Is It Just Me? (2934)
Wireless Televisions. (11)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Regular Build (6)
Is the PSU I received dead? (12)
radeon x850xt platinum & shader.. (5)
Print spooler problem (15)
HIS HD5770 graphic card question (15)
windows vista security holes (9)
Install XP pro and a Vista laptop ?.. (11)
Foreign voltage (10)
Recent Discussions
My monitor won't turn on after instal.. (0)
Internet Lost (0)
Graphics Card Upgrade Questions (0)
Graphics Card Upgrade Question (2)
Asus P4G8X Mobo (6)
radeon x850xt platinum & shader 3 (5)
Xbox 360 GTA: SA disk error (1)
Is the PSU I received dead? (12)
How to convert MP3's (2)
windows 7 internet problem (5)
Multiple Restarts Required at Boot (0)
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)
Laptop with wireless problem. (1)
Wireless Televisions. (11)
Have you switched yet? (86)
screen resolution vs monitor size (2)
sms storage to PC (0)
Regular Build (6)
Open With ..... Win7 (0)
java code for fibonacci (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (35)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Partition Magic caused HDD problem (3)


All times are GMT -4. The time now is 08:03 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28