Welcome Guest, Not a member yet? Register   Sign In
How to redirect localhost php file from webserver php file
#1

[eluser]JasmineFlower[/eluser]
Hi,

I have wen-demo-fence.html file in my localhost.when i submit the form it call fenceServer.php it located in webserver,the values are posted to this fenceserver.php. after finish the database insert process(it works correctly), i need redirect to localhost php file (fence.php)

how can i redirect to the localhost php file from web server php file

I use header('Location: http://192.168.1.3/skycad/fence.php' ); function in fenceServer.php file, but it display the below error

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/a/y/mayisthree3/html/skycad/fenceServer.php:5) in /home/content/m/a/y/mayisthree3/html/skycad/fenceServer.php on line 6
#2

[eluser]Sudz[/eluser]
Can you post your code from where you are redirecting.
#3

[eluser]JasmineFlower[/eluser]
without redirecting how can i post my code.
#4

[eluser]Sudz[/eluser]
I am telling to post your code here in forum so that we can see what's the problem.
#5

[eluser]JasmineFlower[/eluser]
thank u for your response

i used below code for redirect

window. location('http://192.168.1.3/skycad/fence.php'); it works fine, but i don't know this is correct one or not
#6

[eluser]JasmineFlower[/eluser]
hi,

this is my code fenceServer.php


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
&lt;html&gt;
&lt;head&gt;
<.script   type="text/javascript" language="javascript">
function redirect()
{
    window. location = 'http://192.168.1.3/skycad/fence.php';  
    
}
[removed]


&lt;title&gt;eStairs-1m2-Stair&lt;/title&gt;
&lt;/head&gt;
&lt;bodyonload="redirect();" &gt;
&lt;?php
$sort=$_POST["sort"];
$A00=$_POST["A00"]; //Project No.
$A01=$_POST["A01"]; //Customer_code
$A02=$_POST["A02"]; //A
$A03=$_POST["A03"];    //B
$A04=$_POST["A04"];    //C
$A05=$_POST["A05"];    //D
$A06=$_POST["A06"];    //E
$A07=$_POST["A07"];    //F
$A08=$_POST["A08"];    //G
$A09=$_POST["A09"];    //H
$A10=$_POST["A10"];    //I
$A11=$_POST["A11"];    //J
$A12=$_POST["A12"];    //K
$A13=$_POST["A13"];    //L
$A14=$_POST["A14"];    //2D
$A15=$_POST["A15"];    //3D
$A16=$_POST["A16"];    //Dimensioned 2D
$status="open";

$conn=mysql_connect("serverhostname","username","password");
if($conn)
{
    $db=mysql_select_db("dbname",$conn);    
    if($db)
    {
        
        $q=mysql_query("insert into draw_fence(project_no,customer_code,fence_A,fence_B,fence_C,fence_D,fence_E,fence_F,fence_G,fence_H,fence_I,fence_J,fence_K,fence_L,2D,3D,dimen_2D,status)values('$A00','$A01','$A02','$A03','$A04','$A05', '$A06','$A07','$A08','$A09','$A10','$A11','$A12','$A13','$A14','$A15','$A16','$status')");    
        
    }
    else
    {
        echo mysql_error();
    }
}
else
{
    echo "not connected";
}


?&gt;
&lt;/body&gt;
&lt;/html&gt;




Theme © iAndrew 2016 - Forum software by © MyBB