如何完成动态PHP表单POST

时间:2016-02-27 17:21:06

标签: php mysql

我甚至不确定如何将这个问题问到谷歌。

我进行搜索,然后提取客户列表。我有一个输入框和表格,为每个密码更改生成。

如何仅针对特定用户而不是所有正在显示的表单/用户正确进行密码更改?我是否需要在PHP中生成$ _POST ['']或什么?

CODE:

// USER SEARCH
if(isset($_POST['com_btn-search_user_name'])){
echo'<table width="100%" valign=middle" align="left" cellpadding="5" cellspacing="0">
<tr><td>
<h3><font style="padding:4px;padding-left:8px;padding-right:8px;background-color:#730808;color:#fff;border-radius:5px;font-family:"Lucida Sans Unicode"">User Search Results</font></h3>
</td></tr>';
$search_parm=mysql_real_escape_string($_POST['com_name']);
$QUERY_GET_COMPANIES=mysql_query("SELECT * , users.ID AS uID, users.NAME AS uName, users.EMAIL AS uEmail
FROM users
LEFT JOIN (company_user, ownership_reseller_to_company) ON (users.ID = company_user.USER_ID AND company_user.COMPANY_ID = ownership_reseller_to_company.COMPANY_ID)
WHERE users.NAME LIKE '%".$search_parm."%' OR users.EMAIL LIKE '%".$search_parm."%' AND ownership_reseller_to_company.RESELLER_ID='".$_USERID."'");
    // Loop through all the company results.
    while($row=mysql_fetch_array($QUERY_GET_COMPANIES)){
        // If we have company results lets show them. 
        if($row['NAME'] != '' || $row['NAME'] != NULL){
            $QUERY_GET_COMPANIES2=mysql_query("SELECT * FROM companies WHERE ID='".$row['COMPANY_ID']."'");
            $row2=mysql_fetch_array($QUERY_GET_COMPANIES2);
            echo "<tr valign=\"middle\" style=\"border-bottom:1px dotted #aaa\"><td valign=\"middle\"><font style=\"padding:4px;padding-left:8px;padding-right:8px;background-color:#441111;color:#fff;border-radius:5px;font-family:\"Lucida Sans Unicode\"\">".$row2['NAME']."</font> <b>".$row['uName']." </b><b><font style=\"color:red\"> ".$row['uEmail']." </font></b></td> <td valign=\"middle\" align=\"right\"><form name=\"pw\" style=\"padding:0px;margin:0px\"><input type=\"text\" style=\"width: 50px;\" value=\"********\"> <button type=\"submit\" name=\"value_1_1\">CHANGE</button> &nbsp <a href=\"phonebook_mgnt.php?usrid=".$row['uID']."\" class=\"btn btn-success\">PHONEBOOKS</a> &nbsp; <a href=\".php?del=".$row['uID']."\" class=\"btn btn-danger\" onClick=\"return confirm('Are you sure you want to delete?')\">X</a></form></td></tr>";
        }
    }
    echo'<tr><td><br><br></td></tr>';
    echo'</table>';
}

对于我的所有代码,我都会提交POST。但这需要我单独编码$ _POST ['NAME_VALUE']来捕获所有可能的组合。

可能只是将用户ID和密码发送到URI

更为理想

0 个答案:

没有答案