2013-02-12 80 views
0

在这里,我有重定向用PHP形式的URL提交页面变化,但该网址是不会改变的问题.......Jquerymobile Page通过PHP重定向URL?

这里是代码:

<form method="post" action="insert.php"> 
<input type="text" id="emp" name="emp" /> 
<input type="submit" value="submit" /> 
</form> 

<?php 
$name =$_POST['name']; 
if($name != '') 
{ 
    header("Location :sample.php"); 
} 
else 
{ 
    header("Location :index.php"); 
} 
?> 

但被重定向,网址为不改变它显示像http:localhost/sample/addForm.php#/sample/insert.php其实我希望它像http:localhost/sample/sample.phphttp:localhost/sample/index.php

+0

缺少域名!将呼叫功能更改为标题(“位置:/sample/sample.php”);和标题(“位置:/sample/index.php”); – 2013-02-12 11:08:16

回答

2

尝试,

if($name != '') 
{ 
    header("Location: /sample/sample.php"); 
} 
else 
{ 
    header("Location: /sample/index.php"); 
} 
+0

感谢兄弟,它适合我.......... – 2013-02-12 11:04:04