第一个单词仅出现在表单文本框中 [英] First word only appearing in a form text box
问题描述
是的,我正在除夕编码.无论如何,我有一个我认为很奇怪的问题(奇怪到需要帮助).以下代码有效(有点).第6行($ row ["sitename"])上的回显输出全名,例如"Huntington Park",但是...表单中的第一个文本框仅显示"Huntington",而不显示名称的第二部分. 以下是屏幕截图.
Yes, I am coding on New Year's eve. Anyway, I have what I think is a strange problem (strange enough to need help). The following code works (sort of). The echo on line 6 ($row["sitename"]) outputs a full name like "Huntington Park", BUT... the first textbox inside the form only shows "Huntington", not the second part of the name. Included below is a snipped of the screen.
$query = "SELECT * FROM `siteinformation`
WHERE `id` = '".$sitedrop."'";
echo $query;
$results = $pdo->query($query);
while ($row = $results->fetch()) {
echo $row["sitename"].'
<form action="dummypage.php" method="post">
<table width="526">
<tr>
<td width="520" align="right"><p>Site Name:
<input type="text" name="sitename" value='.$row["sitename"].'>
</p>
<p>Program:
<input type="text" name="program" value='.$row["program"].'>
</p>
<p>Phone:
<input type="text" name="sitephone" value='.$row["sitephone"].'>
</p>
</td>
</tr>
</table>
</form>';
}
推荐答案
您的代码输出:
<input type="text" name="sitename" value=Huntington Park>
它应该是:
<input type="text" name="sitename" value="Huntington Park">
更改:
<input type="text" name="sitename" value='.$row["sitename"].'>
收件人:
<input type="text" name="sitename" value="'.$row["sitename"].'">
由于该值不在引号中-它仅选择第一个字符串! 您应该对其他输入执行相同的操作.
Since the value is not in quotes - it picks only the first string! You should do the same with the other inputs.
这篇关于第一个单词仅出现在表单文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!