-2

我创建了 index.php 文件,并在 abc.php 中创建了表单,当我输入“index.php/type=abc”之类的 url 路径时,必须执行表单文件,即 abc.php 文件。我该怎么做.

我的 index.php 文件是

<?php include_once('header.php')?>
    <div id="content">
        <div class="min-width">
            <ul id="navmenu">
                <li><a href="tel:+254 0725117848" ><div class="button">CALL IPAIDABRIBE </div></a></li>
                <li><a href="new.php" ><div class="button">new</div></a></li>
                <li><a href="what.php" ><div class="button">what new</div></a></li>
                <li><a href="how.php"><div class="button">how</div></a></li>

            </ul>
        </div>
    </div>
    <?php include_once('footer.php')?>

abc.php 代码是

<form action=" "  method="post" id="contact-mail-page">
<div><div class="dealer-page">
       <h2>Interested in becoming a dealer, retailer or a part of our affiliate program for Picture Keeper? Please type in your
 information below and then click submit. You will be contacted within 48 hours.</p><br/>
 </h2>
        </div>
<div class="review">
<div class="form-item" id="edit-name-wrapper">
 <label for="edit-name">Bussiness Name <span class="form-required" title="This field is required.">*</span></label><br />
 <input type="text" maxlength="255" name="name" id="edit-name" size="30" value="" class="form-text required input">
</div>
<div class="form-item" id="edit-name-wrapper">
 <label for="edit-name">Contact Name </label><br />
 <input type="text" maxlength="255" name="cname" id="edit-cname" size="30" value="" class="form-text required input">
</div>
<div class="form-item" id="edit-name-wrapper">
 <label for="edit-add">Address <span class="form-required" title="This field is required.">*</span></label><br />
 <input type="text" maxlength="255" name="add" id="add" size="200" value="" class="form-text required input">
</div>
<div class="form-item" id="edit-name-wrapper">
 <label for="add1">Address1 <span class="form-required" title="This field is required.">*</span></label><br />
 <input type="text" maxlength="255" name="add1" id="add1" size="200" value="" class="form-text required input">
</div><br/>
<input class="dealer-submit" type="submit" value="Submit">

</div></form>

现在在这里,当我输入像 "index.php?type=abc" 这样的 url 路径时。这个 abc.php 文件必须被执行。我该怎么做?谁能帮我

4

4 回答 4

0

怎么样:

<?php
if ($_REQUEST["type"] = "abc") {
    include ("abc.php");
}
?>

这将出现在您的 index.php 文件中,就在包含页脚的行的上方。

于 2012-06-09T04:17:39.617 回答
0

像这样的东西:

<!--HTML HERE-->
<?php
    if (in_array($_GET['type'], array('abc','more','etc'))){
        include ($_GET['type']. ".php");
    }
?>
<!-- MORE HTML HERE-->
于 2012-06-09T04:17:52.563 回答
0

你到底想要什么?如果你想在 index.php?type=abc Url 被插入时,你重定向到你想要的页面,在 index.php 文件上方添加这个代码。

<?php

$SafePages= array("abc", "login", "signin", "logout");
if(isset($_GET['type']))
if (in_array($_GET['type'],$SafePages))
{
header("location:".$_GET['type'].".php");
}
else
{
 header('HTTP/1.0 404 Not Found');

    echo "<h1>404 Not Found</h1>";

    echo "The page that you have requested could not be found.";

    exit();

}


?>
于 2012-06-09T04:32:20.027 回答
0
<?php
   if (!empty($_GET)
   {

    if ($_GET["type"] = "abc") 
     {
       include ("abc.php");
     }
   }
?>

在 index.php 中包含此代码

于 2012-06-09T04:33:10.733 回答