回声后如何更新

时间:2013-02-28 12:20:34

标签: mysql checkbox textbox echo

我有一个简单的页面,用户可以为一种请求输入他们的信息,然后我有一个单独的页面,回应用户输入的信息。如何在回显信息的每一行中输入复选框和文本框?该复选框适用于请求完成时以及输入完成请求的文本框,一切正常,但我想知道这是否可行?我真的只是想指向正确的方向,因为我似乎无法找到我正在寻找的东西。任何帮助表示赞赏,谢谢,好的方法我会添加我所拥有的。感谢

mysql_select_db('mydb');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "First Name:{$row['firstname']}  <br> ".
     "Last Name: {$row['lastname']} <br> ".
     "Model ID: {$row['modelid']} <br> ".
     "System: {$row['system']} <br> ".
     "Department:{$row['department']}  <br> ".
     "Shift: {$row['shift']} <br> ".
     "Comm: {$row['comm']} <br> ".
     "Other: {$row['other']} <br> ".
     "Comments: {$row['comments']} <br> ".
     "Timestamp: {$row['timestamp']} <br> ".
     "TickeID: {$row['TicketID']} <br> ".
     "-----------------------------------------------------------<br>";
} 
echo "Fetched data successfully\n";
mysql_close($conn);

1 个答案:

答案 0 :(得分:0)

“如何在回显信息的每一行中输入复选框和文本框?”

mysql_select_db('mydb');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
    die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
    echo "First Name:{$row['firstname']}  <br> ".
    "Last Name: {$row['lastname']} <br> ".
    "Model ID: {$row['modelid']} <br> ".
    "System: {$row['system']} <br> ".
    "Department:{$row['department']}  <br> ".
    "Shift: {$row['shift']} <br> ".
    "Comm: {$row['comm']} <br> ".
    "Other: {$row['other']} <br> ".
    "Comments: {$row['comments']} <br> ".
    "Timestamp: {$row['timestamp']} <br> ".
    "TickeID: {$row['TicketID']} <br> ".
    "-----------------------------------------------------------<br>".
    "<form action='target.php' method='POST'>"
        "<input type='checkbox' id='1' value='Option 1'>Option 1<br />".
        "<input type='checkbox' id='2' value='Option 2'>Option 2".
        "<input type='text' id='textBox1' value='' />".
    "</form>";
} 
echo "Fetched data successfully\n";
mysql_close($conn);

你应该养成将字符串绑定到变量并使用变量而不是普通字符串的习惯,这只是一种更好的做法。