POST无法用于文本框 [英] POST not working for textbox
本文介绍了POST无法用于文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将表格数据显示在html表中,例如.net中的网格视图
它可以正常工作,但我无法从PHP中的表中访问数据.
Hi I have displayed my table data in a html table like grid view in .net
Its working but i coudln''t access the data from the table in PHP.
function jsfun(var1_name)
{
document.getElementById('htext1').value=var1_name;
var x="<?php pfun();?>";
alert(x);
return false;
}
<?php
function pfun()
{
$a=$_POST['htext1'];// giving error as unterminated string or constant
echo($a);
}
<?php
if(isset($_POST['btnDisplay']))//button in my form design
{
echo "<form method='post' action='";
echo $_SERVER['PHP_SELF'];
echo "'/><table border='2' cellspacing='2' cellpadding='2'><tr><td><font face='Arial, Helvetica, sans-serif' color='#ff0000'>LoginId</font></td><td><font face='Arial, Helvetica, sans-serif' color='#ff0000'>UserName</font></td><td><font face='Arial, Helvetica, sans-serif' color='#ff0000'>Password</font></td><td><font face='Arial, Helvetica, sans-serif' color='#ff0000'>Modify</font></td></tr>";
$query=mysql_query("call prcLoginDisplay()");
while($res=mysql_fetch_array($query))//getting data from database and display like gridview using html table
{
echo "<tr><td><input type='text' id='txtTLoginId' value='";
echo $res['intLoginId'];//display in textbox inside html
echo "' name='";
echo "t".$res['intLoginId'];//creating textbox name to identify uniquely
echo "'/></td><td><input type='text' id='txtTLoginId' value='";
echo $res['vchUserName'];
echo "' name='";
echo "ut".$res['intLoginId'];
echo "'/></td><td><input type='text' id='txtTLoginId' value='";
echo $res['vchPassword'];
echo "' name='";
echo "pt".$res['intLoginId'];
echo "'/></td><td>";
echo "<input type='button' value='submit' id='btnUpdate' name='";
echo $res['intLoginId'];
echo "' önclick='jsfun(this.name)'/></td></tr>";//calling javascript function
}
echo "</table>";
echo "</form>";
echo "<form method='post' action='";
echo $_SERVER['PHP_SELF'];
echo "'><input type='text' id='htext1' name='htext1' runat="server"/></form>";
}
?>
在这里,我在html表的文本框中显示了数据,并为每个文本框和按钮生成了唯一的名称.每当用户单击网格中的按钮时,文本框内容将被复制到隐藏字段中.现在,我想在php中访问此隐藏字段.如何执行此操作?请帮助.
Here i have displayed data inside textbox in html table and generating unique name for each textbox and button.Whenever user click the button in grid the textbox content will get copied to a hidden field. Now i want to access this hidden field in php How to do this? Pls help.
推荐答案
a =
_POST [' htext1']; // 以未终止的字符串或恒定 echo(
_POST['htext1'];// giving error as unterminated string or constant echo(
a); }
<?php
if(isset(
这篇关于POST无法用于文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文