I have a problem on how to get the value of a textbox, i'm using modal bootstrap. I listed my data using while loop on PHP.
我有一个关于如何获取文本框值的问题,我正在使用模态引导程序。我在PHP上使用while循环列出了我的数据。
this is the code for displaying my data:
这是显示我的数据的代码:
$query=mysql_query("select * from tbl_messages where alumni= '$alumni' GROUP BY title ");
while($res=mysql_fetch_array($query)){
echo "<a href='messageview.php?id=$msgID#myModal' role='button' data-toggle='modal' data-title= '".$res['title']."' class='messages'>".$res['title']."</a>";
echo "From:".$res['company'];
echo $res['message'];
this is the modal.
这是模式。
x Message
$db=mysql_query("select * from tbl_messages where title = '$msgTitle' and alumni = '$alumni' ")or die(mysql_error());
while($sa=mysql_fetch_array($db)){
echo "<div style='border:0px solid black;'>";
echo "<b>".$sa['user'].":</b><br>";
echo $sa['message'];
echo "</div>";
}
?>
</form>
The problem is, I want to get the $res['title'] that is listed on my while loop and pass is to the php variable to put on my SQL statement. Anyone can help me? please. thanks a lot.
问题是,我想得到我的while循环中列出的$ res ['title']并传递给php变量以放入我的SQL语句。有人可以帮帮我吗?请。非常感谢。
1 个解决方案
#1
0
Can't you do the simple string concatenation?
你不能做简单的字符串连接吗?
$db=mysql_query("select * from tbl_messages where title = '" . $res['title'] . "'");
I haven't ran this code so you might want to play around with quote characters. Btw, I don't think the question has anything to do with Bootstrap.
我没有运行此代码,因此您可能想要使用引号字符。顺便说一句,我不认为这个问题与Bootstrap有什么关系。
#1
0
Can't you do the simple string concatenation?
你不能做简单的字符串连接吗?
$db=mysql_query("select * from tbl_messages where title = '" . $res['title'] . "'");
I haven't ran this code so you might want to play around with quote characters. Btw, I don't think the question has anything to do with Bootstrap.
我没有运行此代码,因此您可能想要使用引号字符。顺便说一句,我不认为这个问题与Bootstrap有什么关系。