2013-08-05 36 views
-4

我有一个PHP脚本,创建一个表name,salescert列。 我有一个声明,如果只显示对登录用户的记录证书栏的图标。所有这些工作正常。MySQL表,单击记录以选择

现在我想设置它,所以当用户单击显示的证书图标时,它将$_POST[year]$_POST[sales]传递给test.php脚本。我尝试使用下面的代码片段要做到这一点,但我有问题:

$form_start="<form name='test' method='post' action='test.php'>";    
$form_end="</form>"; 
echo "<td>".$row['year']."&nbsp;</td><td><b>".$row['name']."</b></td><td>".$row['sales']."</td><td>". '<input type="submit"; value='.$row['sales'].'; style="background:url('.$cert_image.'); width: 24px; height: 17px; border: none; no-repeat; />'."</td></tr>"; 

任何人都可以点我在正确的方向吗?

OK我现在有下面的代码:

$form_start="<form name='test' method='post' action='test.php'>";    
$form_end="</form>"; 
echo "<td>".$row['year']."</td><td><b>".$row['name']."</b><input type='hidden'; name='cYear'; value=".$row['year']."/></td><td>".$row['sales']."<input type='hidden'; name='cSales'; value=".$row['sales']." /></td><td><input type='image'; src=$cert_image width: 24px; height: 17px; border: none; no-repeat; alt='Click to revive your Annual Table Certificate'; /></td></tr>"; 

这看起来正确的(至少对我来说),但是当我上的图像文件,单击表行想,什么都不会发生即test.php的文件不被称为: $ form_start = “”;

任何人有任何想法,我做错了什么吗?

+1

在每个标签为什么有分号的? EG在'test''和''action'之间开始? – stUrb

+0

这就是我认为必须有的“坏”。去除它们并没有什么不同。我现在可以调用test.pgp,但是我发布的值是空的。 – Taffman

+0

这可以全部合并为一个声明 – bowlerae

回答

1

不要忘记<form ... >method="post"

<form name='test' method="post" action='test.php'> 
+0

感谢您的这一点。我现在添加了method ='post',它正在调用我的test.php脚本,但$ _POST ['year']和$ _POST ['sales']在test.php中是空的? – Taffman

+0

但是你的在哪里? – Dawlys

+0

Justed编辑我原来的帖子来显示我的输入。 – Taffman