2013-02-12 78 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