我创建了index.php文件,我在abc.php中创建了表单,当我输入url路径如“index.php / type = abc”时,表单文件即必须执行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>
现在我在这里键入url路径,如“index.php?type = abc”。必须执行这个abc.php文件。我可以这样做吗? 任何人都可以帮助我
答案 0 :(得分:0)
怎么样:
<?php
if ($_REQUEST["type"] = "abc") {
include ("abc.php");
}
?>
这将放在你的index.php文件中,就在包含页脚的行的上方。
答案 1 :(得分:0)
这样的事情:
<!--HTML HERE-->
<?php
if (in_array($_GET['type'], array('abc','more','etc'))){
include ($_GET['type']. ".php");
}
?>
<!-- MORE HTML HERE-->
答案 2 :(得分: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();
}
?>
答案 3 :(得分:0)
<?php
if (!empty($_GET)
{
if ($_GET["type"] = "abc")
{
include ("abc.php");
}
}
?>
在index.php中包含此代码