你好,我需要你的帮助或建议我的一个问题,所以问题是我有一个多语言网站(现在有2种语言),并有一个广告发布表格女巫从http://newproject.comli.com/step1.php开始并转到step2,如果我在step2文件上更改语言,问题就会出现,它会给我一个错误:enter image description here
你不会在主机上看到这些错误但是没有结果以太。 所以基本上我发送一个id从s step1到step2,用户选择ID显示他们选择的类别女巫,然后插入数据库,如果我尝试在插入后尝试更改语言,也会得到这些错误(我的意思是我把它们插入到数据库中然后如果我改变了一种语言它给了我一大堆错误它可以移动到另一个页面如果你试图改变语言或只是另一种方法来避免那些错误)插入页面准备好但是我在我的主机上为它创建了一个表,所以它不会在那里工作
这是我的网页代码,只是为了更容易理解我在说什么,而软件就是问题:
step1.php
<?php
include_once 'common.php';
?>
<!DOCTYPE html>
<html lang="<?php echo $lang['LANG']; ?>">
<head>
<title><?php echo $lang['PAGE_TITLE']; ?></title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/ism-2.1.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$(".level2 > li").hide();
$(".level1 > li").on("click", function() {
$(this).siblings().css("background-color", "transparent");
$(this).css("background-color", "#f1f1f1");
idx = $(this).index();
$(".level2 > li").hide();
$(".level2 > li").eq(idx).show();
});
$(".level3").hide();
$(".level2 > li > ul > li").on("click", function() {
$(".level2 > li > ul > li").css("background-color", "transparent");
$(this).css("background-color", "#f1f1f1");
$(".level3").hide();
var idx2 = $(this).index();
var idx1 = $(this).parent().parent().index();
$(".level3").show();
$("#catid").val("CAT" + (idx1+1) + "-" + (idx2+1));
});
});
</script>
</head>
<body>
<div class="advtop">
</div>
<div id="topbar2">
<div id="lang">
<ul>
<li>
<a href="?lang=lt" ><img src="image/Lithuania.png" ></a>
</li>
<li>
<a href="?lang=en"><img src="image/United Kingdom.png" ></a>
</li>
</ul>
</div>
<div id="text">
<ul>
<li>
<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
echo "Sveiki"; ?> <a href="#"><?php echo $_SESSION["username"]; ?></a><?php
}else {
?> <a href="post.php" ><?php echo $lang['LOGIN']; ?></a> <?php
}
?><span> |</span>
</li>
<li>
<a href="#" ><?php echo $lang['MYACC']; ?><span class="icn"> ▽</span></a>
<ul class="dropdown">
<li><a class="first" href="#"><?php echo $lang['FAV']; ?> (0)</a></li>
<li><a href="#"><?php echo $lang['ADS']; ?></a></li>
<li><a href="#"><?php echo $lang['DETAILS']; ?></a></li>
<li>
<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
?> <a href="logout.php" ><?php echo $lang['LOGOUT']; ?></a> <?php
}else {
?> <a href="post.php" ><?php echo $lang['REGISTER']; ?></a> <?php
} ?>
</li>
</ul>
</li>
</ul>
</div>
<div id="postadv">
<a href="<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
echo "step1.php";
}else {
echo "post.php";
}
?>" ><?php echo $lang['POST']; ?></a>
</div>
</div>
<div id="logo2"><a href="index.php"><img src="image/logo.png"></a></div>
<div id="searchbox2">
<form class="form" action="search.php" method="get">
<input class="search-field" type="search" name="search" size="70" maxlength="50" placeholder="<?php echo $lang['SRC']; ?>" height="50">
<select class="categories" name="categories">
<option value="0" selected="selected"><?php echo $lang['ALLCAT']; ?></option>
<option value="1"><?php echo $lang['CAT1']; ?></option>
<option value="2"><?php echo $lang['CAT2']; ?></option>
<option value="3"><?php echo $lang['CAT3']; ?></option>
<option value="4"><?php echo $lang['CAT4']; ?></option>
<option value="5"><?php echo $lang['CAT5']; ?></option>
<option value="6"><?php echo $lang['CAT6']; ?></option>
<option value="7"><?php echo $lang['CAT7']; ?></option>
<option value="8"><?php echo $lang['CAT8']; ?></option>
<option value="9"><?php echo $lang['CAT9']; ?></option>
</select>
<input class="submit-button" type="submit" value="<?php echo $lang['SRCBTN']; ?>">
</form>
<a href="#" ><?php echo $lang['ADVSRC']; ?></a>
</div>
<div id="itemsCategLists">
<ul class="level1">
<li>
<span><?php echo $lang['CAT1']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT2']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT3']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT4']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT5']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT6']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT7']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT8']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
<li>
<span><?php echo $lang['CAT9']; ?></span>
<i class="fa fa-chevron-right"></i>
</li>
</ul>
<ul class="level2">
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT1-1']; ?></span></li>
<li><span><?php echo $lang['CAT1-2']; ?></span></li>
<li><span><?php echo $lang['CAT1-3']; ?></span></li>
<li><span><?php echo $lang['CAT1-4']; ?> </span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT2-1']; ?></span></li>
<li><span><?php echo $lang['CAT2-2']; ?></span></li>
<li><span><?php echo $lang['CAT2-3']; ?></span></li>
<li><span><?php echo $lang['CAT2-4']; ?></span></li>
<li><span><?php echo $lang['CAT2-5']; ?></span></li>
<li><span><?php echo $lang['CAT2-6']; ?></span></li>
<li><span><?php echo $lang['CAT2-7']; ?></span></li>
<li><span><?php echo $lang['CAT2-8']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT3-1']; ?></span></li>
<li><span><?php echo $lang['CAT3-2']; ?></span></li>
<li><span><?php echo $lang['CAT3-3']; ?></span></li>
<li><span><?php echo $lang['CAT3-4']; ?></span></li>
<li><span><?php echo $lang['CAT3-5']; ?></span></li>
<li><span><?php echo $lang['CAT3-6']; ?></span></li>
<li><span><?php echo $lang['CAT3-7']; ?></span></li>
<li><span><?php echo $lang['CAT3-8']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT4-1']; ?></span></li>
<li><span><?php echo $lang['CAT4-2']; ?></span></li>
<li><span><?php echo $lang['CAT4-3']; ?></span></li>
<li><span><?php echo $lang['CAT4-4']; ?></span></li>
<li><span><?php echo $lang['CAT4-5']; ?></span></li>
<li><span><?php echo $lang['CAT4-6']; ?></span></li>
<li><span><?php echo $lang['CAT4-7']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT5-1']; ?></span></li>
<li><span><?php echo $lang['CAT5-2']; ?></span></li>
<li><span><?php echo $lang['CAT5-3']; ?></span></li>
<li><span><?php echo $lang['CAT5-4']; ?></span></li>
<li><span><?php echo $lang['CAT5-5']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT6-1']; ?></span></li>
<li><span><?php echo $lang['CAT6-2']; ?></span></li>
<li><span><?php echo $lang['CAT6-3']; ?></span></li>
<li><span><?php echo $lang['CAT6-4']; ?></span></li>
<li><span><?php echo $lang['CAT6-5']; ?></span></li>
<li><span><?php echo $lang['CAT6-6']; ?></span></li>
<li><span><?php echo $lang['CAT6-7']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT7-1']; ?></span></li>
<li><span><?php echo $lang['CAT7-2']; ?></span></li>
<li><span><?php echo $lang['CAT7-3']; ?></span></li>
<li><span><?php echo $lang['CAT7-4']; ?></span></li>
<li><span><?php echo $lang['CAT7-5']; ?></span></li>
<li><span><?php echo $lang['CAT7-6']; ?></span></li>
<li><span><?php echo $lang['CAT7-7']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT8-1']; ?></span></li>
<li><span><?php echo $lang['CAT8-2']; ?></span></li>
<li><span><?php echo $lang['CAT8-3']; ?></span></li>
<li><span><?php echo $lang['CAT8-4']; ?></span></li>
<li><span><?php echo $lang['CAT8-5']; ?></span></li>
</ul>
</li>
<li>
<ul class="level2list1">
<li><span><?php echo $lang['CAT9-1']; ?></span></li>
<li><span><?php echo $lang['CAT9-2']; ?></span></li>
<li><span><?php echo $lang['CAT9-3']; ?></span></li>
<li><span><?php echo $lang['CAT9-4']; ?></span></li>
</ul>
</li>
</ul>
<div class="level3">
<form id="step1" action="step2.php" method="post">
<input type="hidden" name="catid" id="catid">
<input class="submit-button" type="submit" name="submint" value="<?php echo $lang['NEXT']; ?>">
</form>
</div>
</div>
<div class="footer2">
<div class="copy">
<ul>
<li>
<a href="#" ><?php echo $lang['TERMS']; ?></a>
</li>
<li>
<a href="#" ><?php echo $lang['CONTACT']; ?></a>
</li>
</ul>
<span style="font-size: 13px; color: black"><?php echo $lang['COPY']; ?></span>
</div>
</div>
</body>
</html>
和step2.php
<?php
include_once 'common.php';
?>
<!DOCTYPE html>
<html lang="<?php echo $lang['LANG']; ?>">
<head>
<title><?php echo $lang['PAGE_TITLE']; ?></title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/ism-2.1.js"></script>
</head>
<body>
<div class="advtop">
</div>
<div id="topbar2">
<div id="lang">
<ul>
<li>
<a href="?lang=lt" ><img src="image/Lithuania.png" ></a>
</li>
<li>
<a href="?lang=en"><img src="image/United Kingdom.png" ></a>
</li>
</ul>
</div>
<div id="text">
<ul>
<li>
<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
echo "Sveiki"; ?> <a href="#"><?php echo $_SESSION["username"]; ?></a><?php
}else {
?> <a href="post.php" ><?php echo $lang['LOGIN']; ?></a> <?php
}
?><span> |</span>
</li>
<li>
<a href="#" ><?php echo $lang['MYACC']; ?><span class="icn"> ▽</span></a>
<ul class="dropdown">
<li><a class="first" href="#"><?php echo $lang['FAV']; ?> (0)</a></li>
<li><a href="#"><?php echo $lang['ADS']; ?></a></li>
<li><a href="#"><?php echo $lang['DETAILS']; ?></a></li>
<li>
<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
?> <a href="logout.php" ><?php echo $lang['LOGOUT']; ?></a> <?php
}else {
?> <a href="post.php" ><?php echo $lang['REGISTER']; ?></a> <?php
} ?>
</li>
</ul>
</li>
</ul>
</div>
<div id="postadv">
<a href="<?php
if(isset($_SESSION["username"]) && time() - $_SESSION["CREATED"] < 1800){
echo "step1.php";
}else {
echo "post.php";
}
?>" ><?php echo $lang['POST']; ?></a>
</div>
</div>
<div id="logo2"><a href="index.php"><img src="image/logo.png"></a></div>
<div id="searchbox2">
<form class="form" action="search.php" method="get">
<input class="search-field" type="search" name="search" size="70" maxlength="50" placeholder="<?php echo $lang['SRC']; ?>" height="50">
<select class="categories" name="categories">
<option value="0" selected="selected"><?php echo $lang['ALLCAT']; ?></option>
<option value="1"><?php echo $lang['CAT1']; ?></option>
<option value="2"><?php echo $lang['CAT2']; ?></option>
<option value="3"><?php echo $lang['CAT3']; ?></option>
<option value="4"><?php echo $lang['CAT4']; ?></option>
<option value="5"><?php echo $lang['CAT5']; ?></option>
<option value="6"><?php echo $lang['CAT6']; ?></option>
<option value="7"><?php echo $lang['CAT7']; ?></option>
<option value="8"><?php echo $lang['CAT8']; ?></option>
<option value="9"><?php echo $lang['CAT9']; ?></option>
</select>
<input class="submit-button" type="submit" value="<?php echo $lang['SRCBTN']; ?>">
</form>
<a href="#" ><?php echo $lang['ADVSRC']; ?></a>
</div>
<div id="itemsCategLists2">
<div class="post2" >
<form class="formstyle" action="final.php" method="post" >
<div class="adtext">
<p><b><?php echo $lang['KAT']; ?>:</b>
</p>
<p><b><?php echo $lang['ACTION']; ?>*:</b>
</p>
<p><b><?php echo $lang['ADTITLE']; ?>*:</b><br>
</p>
<p><b><?php echo $lang['ADDETAILS']; ?>*:</b>
</p><br><br><Br>
<p><b><?php echo $lang['PRICE']; ?>*:</b>
</p>
<p><b><?php echo $lang['ADPHOTOS']; ?>:</b>
</p>
<p><b><?php echo $lang['UARE']; ?>*:</b>
</p>
<p><b><?php echo $lang['PHONE']; ?>*:</b>
</p>
<p><b><?php echo $lang['EMAIL']; ?>:</b>
</p>
<p><b><?php echo $lang['LOCATION']; ?>*:</b>
</p>
<p><b><?php echo $lang['NAME']; ?>*:</b>
</p>
<p><b><?php echo $lang['WEB']; ?>:</b>
</p>
</div>
<div class="entry">
<?php
$catid = $_POST['catid'];
$catid2 = substr($catid,0,4);
$cat1 = $lang[$catid2];
$cat2 = $lang[$catid];
echo "<font color='grey'>".$cat1." » ".$cat2."</font>";
?>
<br style="margin-bottom: 17px;">
<input type="hidden" name="catid" value="<?php echo $catid; ?>">
<input type="radio" name="action" value="1" required> <?php echo $lang['PORPOSE']; ?>
<input type="radio" name="action" value="2" required> <?php echo $lang['LOOKING']; ?><br style="margin-bottom: 15px;">
<input type="text" name="title" maxlength="80" pattern=".{10,}" title="At Least 10 symbols" min="10" style="width: 379px;" required><br style="margin-bottom: 15px;">
<textarea name="details" rows="10" cols="30" pattern=".{10,}" title="At Least 10 symbols" style="width: 379px; height: 75px;" maxlength="5500" required></textarea><br><br style="margin-bottom: 5px;">
<input type="text" name="price" maxlength="10" pattern="\d+(\.\d{2})?" title="Only numbers" required><br style="margin-bottom: 15px;">
<input type="file" multiple="true" name="image[]"><br style="margin-bottom: 15px;">
<input type="radio" name="ocp" value="1" required><?php echo $lang['PRV']; ?>
<input type="radio" name="ocp" value="2" required><?php echo $lang['BSN']; ?><br style="margin-bottom: 15px;">
<input type="text" name="phonenumber" pattern="^\s*\(?(020[7,8]{1}\)?[ ]?[1-9]{1}[0-9{2}[ ]?[0-9]{4})|(0[1-8]{1}[0-9]{3}\)?[ ]?[1-9]{1}[0-9]{2}[ ]?[0-9]{3})\s*$" title="Only UK Phone numbers ( 07*********) " required><br style="margin-bottom: 15px;">
<input type="email" name="email"><br style="margin-bottom: 15px;">
<input type="text" name="location" pattern=".[A-Za-z]{3,15}" title="Only letter (4-15 symbols)" required><br style="margin-bottom: 15px;">
<input type="text" name="name" pattern=".[A-Za-z]{3,15}" title="Only letter (4-15 symbols)" required><br style="margin-bottom: 15px;">
<input type="text" name="web" pattern="www\.\w+\.\w{2,3}|www\.\w+\.\w{2,3}\.\w{2}" title="Format :(www.website.com) "><br style="margin-bottom: 15px;">
<input class="submit-button" type="submit" name="submit" value="<?php echo $lang['POSTADV']; ?>">
</div>
</form>
</div>
</div>
<div class="footer2">
<div class="copy">
<ul>
<li>
<a href="#" ><?php echo $lang['TERMS']; ?></a>
</li>
<li>
<a href="#" ><?php echo $lang['CONTACT']; ?></a>
</li>
</ul>
<span style="font-size: 13px; color: black"><?php echo $lang['COPY']; ?></span>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
好吧所以我想一点,并找到一个解决方案,这不是最好的一个,但它的接缝没有其他可以帮助我除了我自己所以我会尝试做的是检查catid是否isset然后只是重定向回到step1所以如果some1尝试访问step2页面,它将只重定向到step1因为catid将不是isset并且与语言相同当我更改语言catid变得不是isset并且它应该将我重定向到step1页面,告诉我,如果我我正在思考一个正确的方法,如果不是我做错了什么