表单到两个不同的PHP文件

时间:2014-08-12 18:49:29

标签: php forms intranet

我需要获取一个表单来提交两个不同的PHP文件,以便以两种不同的方式显示信息。我正在创建一个公司内部网,现在正在联系页面上工作。我有一个目前设置为嵌套表单的表单来显示我想要做的事情(我知道它不会那样工作)。

这就是我现在所拥有的。

<body style="background-color: #000000">
<form action="library/submit_corporate.php" method="post">
<form action="library/show_all_corporate.php" method="post">

<hr style="border: 1px solid #FFB25F"/>
<label>


<h3>Find A Corporate Contact</h3>
<br>
<table style="margin: auto;">
<tr>
<td style="color: #FF8500">
    Contact Name:
</td>
<td>        <input name="customer" id="C" type="text" style="width: 200px" />
</td>
<td id="C"></td>
</tr>
<tr>
<td style="color: #FF8500"> OR FIND BY: </td>
</tr>
<tr>
<td style="color: #FF8500">
    Business Name:
</td>
<td>        <input name="business" id="B" type="text" style="width: 200px" />
</td>
<td id="B"></td>
</tr>
<tr>
<td>&nbsp; </td>
<td><input type="submit" name="findThem" value="Find" class="submit" /></td>
</tr>

</table>
</label>
</form>
</form>

这就是我试图从第一个动作PHP文件中访问它的方式:

    

        $name = $_POST['customer'];
        $business = $_POST['business'];

        include ("dbcon.php");
        fopen ("dbcon.php", "r");
        $result = mysqli_query($connect,"Select * FROM customers WHERE Business = '$name' OR Name = '$name' ");
        while ($row = mysqli_fetch_array($result))
        {
            echo "Contact's Name: ".$row['Name'];
            echo "<br>";
            echo "Business Name: ".$row['Business'];
            echo "<br>";
            echo "Phone Number: ".$row['PhoneNum'];
            echo "<br>";
            echo "Email: ".$row['Email'];
            echo "<br>";
            echo "Service: ".$row['Service'];
            echo "<br>";
            echo "<br>";

        }
?>
<table>
<tr>
<td><p>Do you want to see more about the contact?</p></td>
</tr>
<tr>
<td><form method="link" action="show_all_corporate.php">
    <input type="submit" value="Yes" class="submit"/>
    </form>
</td>
<td><form method="link" action="http://example.com/index.php">
    <input type="submit" value="No" class="submit"/>
    </form>
</td>
</tr>
</table>

我希望得到任何帮助......

0 个答案:

没有答案