»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 07-05-2003, 11:43 PM   #1 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
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 07-05-2003, 11:59 PM   #2 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
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 07-06-2003, 09:14 AM   #3 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
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
LittleKing is offline   Reply With Quote
Old 07-06-2003, 07:41 PM   #4 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
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 07-08-2003, 11:23 AM   #5 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
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




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 04:21 AM.