简体   繁体   English

仅当字段中不存在任何值时显示“提交”按钮,否则显示值

[英]Submit Button only when no value present in field otherwise value shows

I'm trying to figure out how to make this code snippet display the value or the button but not both. 我试图弄清楚如何使此代码片段显示值或按钮,但不能同时显示两者。 As you'll see there is a button for "Call_Attempt_One". 如您所见,这里有一个“ Call_Attempt_One”按钮。 I'm trying to have it only display when there is no value in the field but have the field value displayed when there is a value and have the button disappear. 我试图让它仅在字段中没有值时显示,而在有值时显示字段值,并使按钮消失。

Suggestions?? 建议? Thanks! 谢谢!

<td style='font-size:12px;width:500px;'><div style=\"overflow-x:auto; max-height:100px\">{$row['Project_Description']}</div></td>
<td style='font-size:12px;'><center>{$row['Restoration_Decision_Matrix']}</center></td>
<td style='font-size:12px;'><center>

    <form action='".$_SERVER['PHP_SELF']."' method='post'>
    <input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
    <input type='submit' name='formCalledOne' id='formCalledOne' value='Called' />
    </form>
{$row['Call_Attempt_One']}

</center></td>
<td style='font-size:12px;'><center><button type=\"submit\" form=\"form1\" value=\"Submit\">Called</button></center></td>
<td style='font-size:12px;'><center><button type=\"submit\" form=\"form1\" value=\"Submit\">Called</button></center></td>
<td style='font-size:12px;'><center><button type=\"submit\" form=\"form1\" value=\"Submit\">Emailed</button></center></td>
<td style='font-size:12px;'><center>Text Area</center></td>
<td style='font-size:12px;'><center>{$row['Received_Date']}</center></td>
<td style='font-size:12px;'><center>

    <form action='".$_SERVER['PHP_SELF']."' method='post'>
    <input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
    <input type='submit' name='formDelete' id='formDelete' value='Delete' />
    </form>


</center></td>
</tr>";

}

//Check to see if delete button is pressed
if(isset($_POST['formDelete']))
{
    if(isset($_POST['ID']) && !empty($_POST['ID']))
    {
        $ID = $_POST['ID'];
        $result = mysql_query("DELETE FROM Project_Submissions WHERE ID ='".$ID."'");
    }
}   

here is the code that I found to work in my question above. 这是我在上面的问题中发现的有效代码。 I fixed it myself and replaced these lines 我自己修复并替换了这些行

if(isset($_POST['formDelete']))
{
    if(isset($_POST['ID']) && !empty($_POST['ID']))
    {
        $deleteID = $_POST['ID'];
        $result = mysql_query("DELETE FROM Project_Submissions WHERE ID ='".$deleteID."'");
    }
}   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM