0

我需要查询一个数据库,然后用结果填充一个文本框输入。

我正在努力

致电日期:

   <td>
      <?php 
         $selectedSPK=$_POST['SPKSelect'];
        $assigned = $_POST['Sales_Exec'];
        $date = $_POST['DateSelect'];

if ($selectedSPK)

{
    $Call1query = "SELECT  Call1 FROM Data WHERE SPKCustNo  = '$selectedSPK' ";

$Call1result = mysql_query($Call1query);


 while( $row = mysql_fetch_array($Call1result) ){
    $Call1 = $row["$Call1Result"];

    }

}
?>
    <input type="text" name="Call1" id="Call1" value="<?php echo( htmlspecialchars( $Call1) ); ?>"/></td>

但是什么也没说,我哪里出错了,文本输入似乎很难填充!

谢谢!

4

4 回答 4

2

改为使用

$Call1 = $row["Call1"];
于 2012-10-03T10:47:32.563 回答
1

代替

$Call1 = $row["$Call1"];

$Call1 = $row["Call1"];
于 2012-10-03T10:47:08.237 回答
0

问题在这里改变

$Call1 = $row["$Call1Result"];

$Call1 = $row['Call1'];   //here column name comes not variable name
于 2012-10-03T10:48:46.087 回答
0

试试这样

<td>
  <?php 
     $selectedSPK=$_POST['SPKSelect'];
    $assigned = $_POST['Sales_Exec'];
    $date = $_POST['DateSelect'];

if ($selectedSPK)

{
 $Call1query = "SELECT  Call1 FROM Data WHERE SPKCustNo  = '$selectedSPK' ";

$Call1result = mysql_query($Call1query);


 while( $row = mysql_fetch_array($Call1result) ){
$Call1 = $row["Call1"];

}

}?>

<input type="text" name="Call1" id="Call1" value="<?php echo( htmlspecialchars( $Call1) ); ?>"/></td>
于 2012-10-03T11:00:00.893 回答