2013-08-31 17 views
-2

我想從PHP文件中的表單發送一些值,使用ajax函數我想在同一頁面中顯示div中的值。如何從php獲取值並將其加載到同一頁面

+0

嘗試谷歌你一定會找到答案 –

+0

通常,'

'將提交給PHP腳本,這反過來將[重定向到HTML頁面](http://stackoverflow.com/questions/768431/how-對做-A-重定向功能於PHP)。 –

+0

@chiragode我正在尋找兩個小時,我沒有找到解決方案或方法 – neustre

回答

1

page1.php中

<html> 
<body> 

<form name="myform" method="post" action="page2.php"> 
<table> 
<tr> 
<td>First Name :</td> 
<td><input type="text" id="fname" name="fname"></td> 
</tr> 
<tr> 
<td>&nbsp</td> 
<td><input type="submit" id="submit" name="submit" value="save"></td> 
</tr> 

</table> 
</form> 
</body> 
</html> 

使page2.php

<html> 
<body> 
<div><?php echo $_POST['fname']; ?> </div> 
</body> 
</html> 

我希望它會幫助你

+0

我需要的行動形式是一個HTML,因爲我在html5 android應用上工作,所以我想要那些參數去在我的android,PHP的html5頁面不工作資產android! – neustre

相關問題