读书人

php新手的表单提交有关问题

发布时间: 2012-10-16 09:57:37 作者: rapoo

php新手的表单提交问题
-----------------demo.html----------------
<html>
<head>
<title>百度 google</title>
</head>

<body>
<form action="search.php" method="GET">
<input type="text" name="search"/>
<input type="submit" name="submit" value="百度搜索"/>
</form>
</body>
</html>
------------------search.php-----------------
<?php
if(isset($_GET['submit']))
{
header("Location:http://www.baidu.com/s?wd=$_GET['search']");//百度搜索跳转
}
?>

出错提示:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

先谢谢各位了。

[解决办法]
header("Location:http://www.baidu.com/s?wd={$_GET['search']}");//百度搜索跳转

header("Location:http://www.baidu.com/s?wd=$_GET[search]");//百度搜索跳转

读书人网 >PHP

热点推荐