hello dear friend.
on my page i have a form with data with submit bouton when user click on insert data insert into a table all work fine i would like to redirect user to other page after insert into the i use this code

 $insertGoTo = 'order-line.php';
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    echo $insertGoTo;
  die ($insertGoTo);
  header(sprintf("Location: %".$insertGoTo));

on my local server it work fine but on my hosting server the pages is just refresh and and in side this one apear order-line.php?order-line.php?

Remove line 5 and 7, and the % on line 8.

i have change like say page is still refreshing when i clik on submit bouton and no error message only smal remark this the question symbol (?) apear after page.php? on the search bar

$insertGoTo = 'order-line.php';
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: ".$insertGoTo));

It looks fine to me, but what I wonder about is the } on line 7. Looks like this is not all code you have.

this is the code after line 7

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

and after are my dabase data selction....

// I M trying to redirect to another pager after inserting data into database but its not redirecting...can any one help in this




                $sql="INSERT INTO companyreg (ccname,ccemail,ccpass,ccrepass,cccontact) VALUES('$ccname','$ccemail','$ccpass','$ccrepass','$cccontact')";


Replace if($result!=null) with if($result)

$result is never null. It will contain true, false or a resource.

Do this and find out if there is a problem:

$result = mysql_query($sql) or die(mysql_error());

still problem is arising page is not redirecting but data is inserting into database