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: 1413
Discussions: 204,523, Posts: 2,419,635, Members: 249,940
Old July 6th, 2003, 01: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, 01: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, 11:14 AM     #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, 09: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, 01: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
Is It Just Me? (1630)
CBO: Obama's health care plan cuts .. (103)
D.O.D. dismantles Terrorist forum. (8)
newegg=bad people (30)
USB not recognised..... (16)
would this build be enough for WOW? (15)
First time builder (6)
Recent Problem (15)
HTML (7)
Need some suggestions on building a.. (32)
[ F@H Chat] 03/07/10 New Month New.. (92)
Motherboard the culprit? (7)
Windows XP Pro Error log (9)
Suggestions? (6)
Recent Discussions
SSH Tunnel Or OpenVPN? (2)
newegg=bad people (30)
TV tuner (1)
C# Sql Server 2005 Connection Issue (0)
GOM Player with Google Chrome? (0)
First Time PC Builder (Gaming PC) (1)
[ F@H Chat] 03/07/10 New Month New T.. (92)
HTML (7)
re laptop (1)
pc won't start (1)
Outlook keeping 2 copies of sent mess.. (1)
would this build be enough for WOW? (15)
Audio skips when I play a cd or dvd o.. (2)
Microsoft removes hardware virtualiza.. (1)
Lexmark Printer Prestige pro805 (1)
First time builder (6)
Hypercam 2 plays sound too fast (1)
Need some suggestions on building a g.. (32)
IE8 & WLM crash whenever I try to.. (1)
iPad, who's getting one? (60)
Writing lead-out (8)
About to install a new heatsink and I.. (3)
169 ip address question (4)
Help! Cisco Switch port (interface) f.. (1)
Motherboard the culprit? (7)


All times are GMT -4. The time now is 12:08 AM.
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