Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a little help about REDIRECTING for my first php project. 2

Status
Not open for further replies.

jebo100

Technical User
May 11, 2007
52
PH
hello everyone,
i have a form:
<form name="form1" method="POST" action="append2dbase.php">
.
.
<input name="formbutton1" type="submit"
when submitted, it processes the "append2dbase.php"
which look like this:
.
.
"mysql_query(insert into dbase values(...,....,....)"
it runs ok.

all i want is a command line that would automatically redirect me to another page when finished inserting data to my database.
i know this would be simple to you guys:).

i have been scanning my php manuals but i am having a hard time looking for the right command.

thanks in advance!!!
merryXmas to all




 
If you do not output anything after inserting into the database, you can use the header with location specified. Something like:
Code:
header ("Location: newurl.php");
If you've already output something to the page, then you will have to resort to client-side redirecting, using meta tags or javascript.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Or restructure your page so nothing is output before you use the redirect.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 

Vragabond , vacunita

thanks for the help my friends i tried the tips you gave and
it works! (without outputting anything before the HEADER).

i also tried an html code like:
<meta http-equiv="refresh" content="10; url= index.php" />
this one works even if i already outputted something on the page.

"i really dont know if i am doing the right thing here because i have tried it on my localhost, but not yet online:)"

but still, thanks for the help guys!

jebo.

 
This:
Code:
<meta http-equiv="refresh" content="10; url= index.php" />

is fine, and doesn't have the output restriction.

The header option is server side redirection, while meta is client side.

It really doesn't matter which one you use. Just know meta is in no way linked to PHP, while the header method is.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top