我有一个noobish问题(这是我第一次在php中编码)基本上,脚本打开一个按钮,打开一个链接,我试图做的是使用一个变量来以变量的形式分配文本链接的结尾,我似乎无法做到这一点,我试图在链接所在的脚本末尾添加变量,但文本只是在页面上显示,当你按下按钮没有任何反应,我怎么办这样做?
while ( $offer = mysql_fetch_array($result)) {
$getcompleted = "SELECT * FROM `completed` WHERE offer_id='".$offer['id']."' AND user_id='".$ui['id']."'";
$completed = mysql_query($getcompleted) or die(mysql_error());
if (mysql_num_rows($completed)>0) {
continue;
} else {
$getpending = "SELECT * FROM `pending` WHERE offer_id='".$offer['id']."' AND user_id='".$ui['id']."'";
$pending = mysql_query($getpending) or die(mysql_error());
if (mysql_num_rows($pending)==0) {
$getvisited = "SELECT * FROM visited WHERE offer_id='".$offer['id']."' AND user_id='".$ui['id']."'";
$visited = mysql_query($getvisited) or die(mysql_error());
if (mysql_num_rows($visited)==0) {
$button = "Open offer";
} else {
$button = "Submit offer";
}
$link = "<form method=POST><input type=hidden name=action value=complete><input type=hidden name=oid value='".$offer['id']."'><input type=submit value='".$button."'></form>";
} else {
$pend=mysql_fetch_array($pending);
if ($pend['status']==1) { $link = "<font color=yellow>Pending</font>"; }
if ($pend['status']==2) { $link = "<font color=red>Denied</font>"; }
}
print "
<tr>
<td>".htmlentities($offer['name'])."</td>
<td>".$offer['info']."</td>
<td>".htmlentities($offer['country'])."</td>
<td>".htmlentities($offer['reward'])."</td>
<td>".$link."</td>
</tr>";
}
}
答案 0 :(得分:0)
我们在谈论哪个$ link变量?
在此IF中
if(mysql_num_rows($ pending)== 0){
或else
为什么不能在“链接”上手动添加用户ID?
按下按钮后什么都没发生?接收post-php-script可能是问题所在。