Page 1 of 1

redirect page with header function

Posted: Sat Aug 29, 2009 12:50 am
by ranjitbd
i have a feedback.php page with javascript validation..so no one can submit any empty feedback..but after send a feedback if i click on refresh button on browser menu it is submitted again..
i can avoid this by submitted the feedback and take the control to the different page with a flash message that ur feed back submitted successfully..
but question is that i want to stay same feedback.php page after submitted the feed back..and the refresh button will not send the feed back again and again

thanks in advance

Re: redirect page with header function

Posted: Sat Aug 29, 2009 10:46 am
by dheeraj
it can be done by two ways :
1. using header function (php)
2. using window.location (java script)

1st one is

Code: Select all

 
<? . . . . . .
your code
. . . . . .
if(condition is true)
    header("Location: feedback.php");
?>
 
2nd one is using javascript

Code: Select all

 
<? . . . . . .
your code
. . . . . .
if(condition is true){
?>
<script type="text/javascript">
window.location="feedback.php";
</script>
<? }?>
 

Re: redirect page with header function

Posted: Thu Sep 03, 2009 5:38 am
by ranjitbd
dheeraj wrote:it can be done by two ways :
1. using header function (php)
2. using window.location (java script)

1st one is

Code: Select all

 
<? . . . . . .
your code
. . . . . .
if(condition is true)
    header("Location: feedback.php");
?>
 
2nd one is using javascript

Code: Select all

 
<? . . . . . .
your code
. . . . . .
if(condition is true){
?>
<script type="text/javascript">
window.location="feedback.php";
</script>
<? }?>