<?php
if( $_SESSION['user_id'] == '1' || $_SESSION['user_id'] == '7' )
{
echo '<hr class="mx-3 my-0">
<div class="callout callout-warning m-0 py-3">
<div>
<strong>Sas Andreea</strong>
</div>
<small class="text-muted mr-3"><i class="icon-calendar"></i>Salariu Lunar:</small>
<small class="text-muted"><i class="icon-location-pin"></i><input type="text" name="salariulunar" value="' . $row[
'salariulunar'] . '" maxlength="4" size="4"> lei
<br /> Data contract: <input type="text" name="datacontractului" maxlength="10" size="7" value="' . $row['datacontractului'] . ' ">
<br /> Datorie: <input type="text" name="datorie" value="' . $row['datorie'] . '" maxlength="4" size="4"> Lei
<br /> Salariu in avans: <input type="text" value="' . $row['salariuavans'] . ' " name="salariuavans" maxlength="4" size="4"> Lei
<br /> Zile de concediu luate: <input type="text" value="' . $row['zileconcediu'] . '" name="zileconcediu" maxlength="2" size="2"> Zile
</small>
</div>';
}
?>
<!-- Sfarsit angajat -->
<?php
if( $_SESSION['user_id'] == '1' )
{
echo '<button type="submit" name="submit" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o" ></i> Modifica</button>';
}
?>
</form>
我有这个表单,但我需要将它用于更多用户 ex for user_id = 1为user_id = 2提交1个表单以提交另一个表单, 你能帮忙吗?
数据库表有一列u_userid,其中1 = admin 2,3,4,5,6,7是普通用户,每个用户有更多列,我需要更新数据库中的数据
答案 0 :(得分:1)
您可以通过制作像这样的If语句来修复它...
如果($ _ SESSION [&#39; user_id&#39;] ==&#39; 2&#39;)
{
使用更新功能,然后在语句末尾添加“where user_id = 1”
答案 1 :(得分:1)
您有两种选择:
<form action="nameOfYourBackEndFile.php" method="post">
</form>
周围现有代码的标签 AND 您需要一个按钮type="submit"
才能提交表单。或
此外,您需要一种方法来确定填写此表单的用户。您在会话变量中有user_id
,为什么不使用它?您的提交按钮可能如下所示:
<button id="submit_<?php echo $_SESSION['user_id']; />" type="submit">Go</button>
有关您要执行的操作的详细信息,请参阅此示例:
How can I make, when clicking a button, send an email with the data included from the form?