【发布时间】:2013-11-21 21:21:11
【问题描述】:
我在我的代码有一个问题,我想把$意味着可变进我的di innerHTML的,这里是我的代码: 搜索输入.php:
<form action = "search.php" method = "post">
<input name="word" id="word" type="text" maxlength="255" />
<label for="word">word:</label></br></br>
<input type="submit" value="search" />
</form>
<div id = "meaning"> </div>
搜索.php:
<?php
$db = mysql_connect("localhost", "root", "");
mysql_select_db("project",$db);
$word = isset($_POST["word"]) ? $_POST["word"] : "";
$result = mysql_query("select meaning from vocabulary where word = '$word'");
$fetchmeaning = mysql_fetch_array($result);
$meaning = $fetchmeaning['meaning'];
?>
现在我想要这个:
document.getElementById('meaning').innerhtml = $meaning; !!!!
我怎样才能实现这个?
【问题讨论】:
-
可能重复:“如何用 PHP 编写一个 hello world?”。
标签: javascript php jquery mysql innerhtml