菜鸟提问 :如何把书名$bookname;填进去text 框中去 把php放在最上面(在echo $result;之前即可) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的,这是在一个页里面<?php //header('Content-Type:text/html; charset=utf-8');$isbn = '9787308083256';$result = PIPHP_GetBookFromISBN($isbn);function PIPHP_GetBookFromISBN($isbn){ //echo header("Content-Type:text/html;charset=utf-8"); $url = "http://api.douban.com/book/subject/isbn/$isbn"; $page = @file_get_contents($url); $page2xml = @simplexml_load_string($page); $booksummary=$page2xml->summary; //echo $booksummary; $bookname=$page2xml->title; return $bookname;}?><html> <meta http-equiv="Content-Type" content="text/html; charset="utf-8" /> <title>Tour Information</title> <body> <h2>Mission Information</h2> <form action="formaction.php"> <table width="100%"> <tr><td>书名:</td><td><input type="text" name="ship" value='echo $result;' /></td></tr> <tr><td>Trip Date:</td><td><input type="text" name="tripdate" /></td></tr> <tr><td colspan="2">Mission Goals:</td></tr> <tr> <td><input type="checkbox" name="exploration" value="yes" /> Exploration</td> <td><input type="checkbox" name="contact" value="yes" /> Contact</td> </tr> <tr> <td valign="top">Crew species: </td> <td> <select name="crew" multiple="multiple"> <option value="xebrax">Xebrax</option> <option value="snertal">Snertal</option> <option value="gosny">Gosny</option> </select> </td> </tr> <tr><td colspan="2" align="center"><input type="submit" /></td></tr> </table> </form> </body> </html> <tr><td>书名:</td><td><input type="text" name="ship" value='echo $result;' /></td></tr><?php echo $result; ?> <tr><td>书名:</td><td><input type="text" name="ship" value='<? echo $result; ?>' /></td></tr> 书名:</td><td><input type="text" name="ship" value='<?php echo $result;?>' /> 搞定 追问以上输出的是乱码 $page = @file_get_contents($url); $page2xml = @simplexml_load_string($page); $booksummary=$page2xml->summary; //echo $booksummary; $bookname=$page2xml->title; return $bookname; 你的php 的编码 html的编码要一致啊!还有你不觉得你这种方法显得很复杂吗?你可以看看smarty这个很好用,可以将html和你的处理PHP有效的分开。 碶如何替换成矸,高手请教 php连接不上mysql,但Nvicat可以。 .date("Y-m-d H:i:m")修改问题,求助高手 想详细了解一个网站开发的全过程,包括设计,共同部分的处理等等 急!请大侠帮忙!! PHP里调用MYSQL存储过程问题,进来看一下吧! 求救关于win2003 iis6.0 php5.0 mysql 4.1配置问题 PHP写的程序上传问题 一个简单问题,各位帮忙看一下! 用gd图形库生成图片缩略图的代码谁有哇? 为啥这里的$_GET[ ]数组是它的一个方法呢 php 使用curl模拟登录,网站cookie失效怎么解决
//header('Content-Type:text/html; charset=utf-8');$isbn = '9787308083256';$result = PIPHP_GetBookFromISBN($isbn);function PIPHP_GetBookFromISBN($isbn)
{
//echo header("Content-Type:text/html;charset=utf-8"); $url = "http://api.douban.com/book/subject/isbn/$isbn";
$page = @file_get_contents($url);
$page2xml = @simplexml_load_string($page);
$booksummary=$page2xml->summary;
//echo $booksummary;
$bookname=$page2xml->title; return $bookname;
}?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8" />
<title>Tour Information</title>
<body>
<h2>Mission Information</h2>
<form action="formaction.php">
<table width="100%">
<tr><td>书名:</td><td><input type="text" name="ship" value='echo $result;' /></td></tr>
<tr><td>Trip Date:</td><td><input type="text" name="tripdate" /></td></tr>
<tr><td colspan="2">Mission Goals:</td></tr>
<tr>
<td><input type="checkbox" name="exploration" value="yes" />
Exploration</td>
<td><input type="checkbox" name="contact" value="yes" />
Contact</td>
</tr>
<tr>
<td valign="top">Crew species: </td>
<td>
<select name="crew" multiple="multiple">
<option value="xebrax">Xebrax</option>
<option value="snertal">Snertal</option>
<option value="gosny">Gosny</option>
</select>
</td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" /></td></tr>
</table>
</form>
</body>
</html>
<?php echo $result; ?>
$page2xml = @simplexml_load_string($page);
$booksummary=$page2xml->summary;
//echo $booksummary;
$bookname=$page2xml->title; return $bookname;