Php 如果语句未显示正确的数据,则需要帮助

Php 如果语句未显示正确的数据,则需要帮助,php,if-statement,Php,If Statement,我有一个if语句正在工作,它只是没有显示正确的数据 此代码位于一个弹出页面上,当项目缺货时,您可以单击该页面,它会将它们添加到数据库中,当项目缺货时,将发送电子邮件 现在,当点击时,它看起来和工作良好。 它将读为请求以下产品的电子邮件可用性通知:,诸如此类 但当您填写表单时,它将刷新并声明 您将收到通知-谢谢,但下面仍将显示以下产品的请求电子邮件可用性通知:,诸如此类 我只是想表达我的谢意。你知道我做错了什么吗 提前谢谢你的帮助 <?php ob_start(); require_once

我有一个if语句正在工作,它只是没有显示正确的数据

此代码位于一个弹出页面上,当项目缺货时,您可以单击该页面,它会将它们添加到数据库中,当项目缺货时,将发送电子邮件

现在,当点击时,它看起来和工作良好。 它将读为请求以下产品的电子邮件可用性通知:,诸如此类

但当您填写表单时,它将刷新并声明

您将收到通知-谢谢,但下面仍将显示以下产品的请求电子邮件可用性通知:,诸如此类

我只是想表达我的谢意。你知道我做错了什么吗

提前谢谢你的帮助

<?php
ob_start();
require_once('Ambiance/Environment/envi.php');
require_once('Ambiance/Modules/Product.php');
Environment::InitializeVDDB(Environment::dsn());
$product_id = strtoupper($_REQUEST['product_id']);
if (!$db->getOneEx(SQL::checkProductExists($product_id))):
die('Invalid Product ID');
endif;
// Select product info
$product = $db->getRowEx(SQL::getProductInfo($product_id));
$prod = new Product($product);
$image_path = Environment::main_docroot() . '/images/' . $product['as_sub_category_id'] . '/' .                 $product_id;
$prod_details = get_cart_info($prod);
Environment::LoadForms(array('AvailabilityNotification'));
require_once(Environment::include_path() . '/common/common_page_top.php');
?>
<title>Request Availability Notification</title>
<?php
require_once(Environment::include_path() . '/common/common_css.php');
require_once(Environment::include_path() . '/common/common_js.php');
?>
</head>
<body style="background:#D9DADA;">
<div class="commonPopup">
<div class="popupHead">Request Availability Notification</div>
<div class="floatLeft paddingLft20 paddingRgt20">
<? if ($availabilitynotification->isProcessed()): ?>
<p class="bold">You will be notified - Thank you</p>
<? endif;?>
<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
<span class="floatLeft w90p"> 
<span class="floatLeft">
<? if ($thumb = VDFileAccess::get_item_header_img($image_path)): ?> 
<a href="<?=Environment::webroot()?>/product/item.php?product-id=<?=$product_id?>"  title="">    <span class="displayPic"><img class="css3" alt="" src="<?=Environment::webroot()?>/images/product/<?=$product['as_sub_category_id']?>/<?=$product_id?>/thumbs/<?=$thumb?>" ></span></a>
<? else: ?>
<a href="<?=Environment::webroot()?>/product/item.php?product-id=<?=$product_id?>"  title=""><span class="displayPic"><img class="css3" alt="" src="<?=Environment::webroot()?>/images/product/no_image/thumbs/noimage.jpg" ></span></a>
<? endif;?>
</span>
<span class="floatLeft w70p paddingTop10 marginLft15">
<p class="bold floatLeft nobtmMargin"><?=Environment::encode_char($product['name'])?> <?=iif(strlen($product['description']), '- ' . Environment::encode_char($product['description']), '')?></p> 
<div class="clear"></div>
<p class="bold floatLeft notopMargin">Item #<?=$product_id?></p>
</span>
</span>
<section class="commonform  marginTop15"> 
<p class="bold">Enter your email address in the form below</p>
<form method="post" id="email_product_availability" name="email_product_availability" action="<?=$_SERVER['PHP_SELF']?>">
<?=$availabilitynotification->process->getElement()?>
<?=$availabilitynotification->name->getElement()?>
<?=$availabilitynotification->product_id->getElement()?>
<span class="floatLeft">
<span class="inputLeft-Style3 "></span>
<input type="text" name="email" onBlur="if (this.value == '') {this.value = 'E-mail address';}" onFocus="if(this.value == 'E-mail address') {this.value = '';}" value="E-mail address" class="inputMiddle-Style3 width305px"/>
<span class="inputRight-Style3"></span>
<? 
if ($availabilitynotification->hasErrors()):
foreach ($availabilitynotification->getErrors() as $error) {
?>
<label class="error cartError width305px"><?=$error->getMessage()?></label>
<? 
}
endif;
?>
</span>
</form>
</section>
<p class="clear"></p>
<p class="floatLeft w100p"> 
<span class="floatLeft paddingTop10"> 
<a class="textGrey" href="#" onClick="parent.$.fn.colorbox.close();"> 
<span class="greyBtnLft-Big font12">Cancel</span> <span class="greyBtnRgt-Big"></span>
</a> 
</span> 
<span class="floatLeft marginLft30 paddingTop10"> 
<a class="textGrey" href="#" onClick="$('#email_product_availability').submit();"> 
<span class="blueBtnLft-Sml font12">Submit</span> 
<span class="blueBtnRgt-Sml"></span>
</a> 
</span> 
<span class="popupLogo floatRight"></span>
</p>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var x = $(document).height() + 30;
var y = $(document).width();
parent.$.fn.colorbox.resize({width:y, height:x});
});
</script>
</body>
</html>
<?php
ob_end_flush();
?>
看起来就像:

<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
不在任何if或if/else的内部。我想你想要这样的东西:

<? if ($availabilitynotification->isProcessed()): ?>
<p class="bold">You will be notified - Thank you</p>
<? else: ?>
<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
<? endif; ?>

谢谢你,埃里克,这至少给了我正确的方向。我不得不把表格降到底部,这样剩下的表格就不会显示出来了。但在测试后它起了作用。再次感谢!很高兴你弄明白了!