Redirecting page
Moderator: General Moderators
Redirecting page
I have an html form that a user fills in. When the user submits the form the input is checked and if there there are any errors they are displayed. This works fine. If there are not any errors I wish to redirect to another page. The only function I can find for redirecting is header() but I do not understand how it works. It says I am not allowed to display anything before calling it but I clearly have to display my form before redirecting to another page. Can someone please explain to me how this works, I would appreciate any help.
Apologies if this is a repost, I attempted to post this question on friday but I lost my net connection and I cannot find the thread so I think it did not post properly.
Cheers,
westen.
Apologies if this is a repost, I attempted to post this question on friday but I lost my net connection and I cannot find the thread so I think it did not post properly.
Cheers,
westen.
Form Action
You don't want to use the header for submitting a form.
You want to set the action of the form to the page where you are going to process the form. like
you could try looking @
w3 on forms
or just search google for 'form action' or 'form post'
its prety simple you just set the action of the form to be the page you want to send them to
You want to set the action of the form to the page where you are going to process the form. like
Code: Select all
<FORM action="http://somesite.com/prog/adduser" method="post">w3 on forms
or just search google for 'form action' or 'form post'
its prety simple you just set the action of the form to be the page you want to send them to
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
header('Location: http://yourdomain.com/the_page_for_no_errors.php');
die();//don't forget to die after you send the header!Thanks, but thiat is what I already had.
I get the following error message:
Cheers guys.
I get the following error message:
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /home/ulondoco/public_html/header.php:5) in /home/ulondoco/public_html/register.php on line 198