PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 24th, 2004, 11:44 PM
sintrigue sintrigue is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 sintrigue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Redirect AFTER form is processed?

I've seen a lot of questions about redirecting, but none of the solutions have worked for me so far. I'm trying to redirect users to a new location after the form has been processed. The form/page basically lets the user change his/her name and password. When they click "Submit" it posts the data and updates the database, and then returns to the same page.

I'd like to have them fill out the data, click "Submit" and once the database updates the info, have them sent to a different page.

Can this be done? Any assistance is very much appreciated. I know there's quite a few people looking for this same answer. Thanks to all of you for the help.

Sintrigue

Reply With Quote
  #2  
Old June 25th, 2004, 05:11 AM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
PHP Code:
<?

$username 
$_post['username'];
$password $_post['password'];

if (isset(
$username) && isset($password)) {
   
mysql_query(update db set password '$password'username '$username' where id userid);
}

header ("location:http://www.site.sufix/folder");

?>


this is the way to redirect such a script. I use it. And it workes fine.

- pheifel

[edited for spelling error]

Reply With Quote
  #3  
Old June 25th, 2004, 04:02 PM
sintrigue sintrigue is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 sintrigue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the assistance, Pheifel. Unfortunately I'm still getting an error saying header info was already output to the browser. I am using sessions to check security, in case that matters (not sure if it does, very new to this). Any suggestions?

Thanks again!

Sintrigue

Reply With Quote
  #4  
Old June 25th, 2004, 04:44 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
for the header info problem try using ob_start(); and ob_flush();, also check and make sure there is no blank space before your code, because that can cause issues as well

Reply With Quote
  #5  
Old June 25th, 2004, 07:13 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
before the redirect by the header. There can be send Absolutely >>NO<< text or other things to be displayed by the browser. And perhaps (im not sure..) you need a session_start(); in the beginning of the document.

Reply With Quote
  #6  
Old June 28th, 2004, 07:22 AM
xadio xadio is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 xadio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to xadio
I am not sure if your situation has been solved or not. Or even if you do know this already. When I was encountering the same error it was due to me having:

PHP Code:
<?php ?>
 <html>
 
 <head>
   <title></title>
 </head>
 
 <body>
 
 <?php
 
 header 
("location:http://www.site.sufix/folder");
 
 
?>
 
 </body>
 
 </html>


rather than

PHP Code:
<?php
 
 header 
("location:http://www.site.sufix/folder");
 
 
?>


Hope that helps

Reply With Quote
  #7  
Old June 28th, 2004, 03:31 PM
sintrigue sintrigue is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 sintrigue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You all have been great! I had some brain dump, I guess, because I had two forms on the same page trying to submit to different places. Once I started entering the code above, I found my mistake. Works great - THANKS!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Redirect AFTER form is processed?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT