代码
<form onsubmit="return fmChk(this)" method="post" action="<?php echo zen_href_link(zen_get_info_page($_GET['products_id']),'products_id=' . $_GET['products_id']).'#review' ?>" name="post_review" id="post_review">
<div id="reviewsWriteReviewsRate" class="center" style="float:left">Choose a ranking for this item. 1 star is the worst and 5 stars is the best.</div>
<br class="clearBoth" />
<div class="ratingRow" align="left" align="center">
<input type="radio" name="rating" value="1" id="rating-1" /><label class="" for="rating-1"><img src="includes/templates/template_default/images/stars_1_small.gif" alt="One Star" title=" One Star " width="50" height="12" /></label>
<input type="radio" name="rating" value="2" id="rating-2" /><label class="" for="rating-2"><img src="includes/templates/template_default/images/stars_2_small.gif" alt="Two Stars" title=" Two Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="3" id="rating-3" /><label class="" for="rating-3"><img src="includes/templates/template_default/images/stars_3_small.gif" alt="Three Stars" title=" Three Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="4" id="rating-4" /><label class="" for="rating-4"><img src="includes/templates/template_default/images/stars_4_small.gif" alt="Four Stars" title=" Four Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="5" id="rating-5" /><label class="" for="rating-5"><img src="includes/templates/template_default/images/stars_5_small.gif" alt="Five Stars" title=" Five Stars " width="50" height="12" /></label></div>
<div>Your Name: <span color="red">*</span>
<input type="text" chkrule="nnull" chkname="Your Name" class="input_5" value="" name="customer_name"/>
</div>
<label id="textAreaReviews" for="review-text">Please tell us what you think and share your opinions with others. Be sure to focus your comments on the product.</label>
<textarea name="review_text" cols="60" rows="5" id="review-text"></textarea>
<div class="buttonRow forward"><input type="image" src="includes/templates/template_default/buttons/english/button_submit.gif" alt="Submit the Information" title=" Submit the Information " /></div>
<br class="clearBoth" />
<div id="reviewsWriteReviewsNotice" class="notice" align="left">NOTE: HTML tags are not allowed.<br />NOTE: Reviews require prior approval before they will be displayed</div>
<br class="clearBoth" />
</form>
当我填好数据后点击提交,没法实现插入数据库,因为我是这么判断的
if ($_POST['action']) {执行插入}
通过echo $_POST['action'];我发现$_POST['action']为空,于是
我试了 if (empty($_POST['action'])) {执行插入}
这个时候插入数据库成功
为什么???
<form onsubmit="return fmChk(this)" method="post" action="<?php echo zen_href_link(zen_get_info_page($_GET['products_id']),'products_id=' . $_GET['products_id']).'#review' ?>" name="post_review" id="post_review">
<div id="reviewsWriteReviewsRate" class="center" style="float:left">Choose a ranking for this item. 1 star is the worst and 5 stars is the best.</div>
<br class="clearBoth" />
<div class="ratingRow" align="left" align="center">
<input type="radio" name="rating" value="1" id="rating-1" /><label class="" for="rating-1"><img src="includes/templates/template_default/images/stars_1_small.gif" alt="One Star" title=" One Star " width="50" height="12" /></label>
<input type="radio" name="rating" value="2" id="rating-2" /><label class="" for="rating-2"><img src="includes/templates/template_default/images/stars_2_small.gif" alt="Two Stars" title=" Two Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="3" id="rating-3" /><label class="" for="rating-3"><img src="includes/templates/template_default/images/stars_3_small.gif" alt="Three Stars" title=" Three Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="4" id="rating-4" /><label class="" for="rating-4"><img src="includes/templates/template_default/images/stars_4_small.gif" alt="Four Stars" title=" Four Stars " width="50" height="12" /></label>
<input type="radio" name="rating" value="5" id="rating-5" /><label class="" for="rating-5"><img src="includes/templates/template_default/images/stars_5_small.gif" alt="Five Stars" title=" Five Stars " width="50" height="12" /></label></div>
<div>Your Name: <span color="red">*</span>
<input type="text" chkrule="nnull" chkname="Your Name" class="input_5" value="" name="customer_name"/>
</div>
<label id="textAreaReviews" for="review-text">Please tell us what you think and share your opinions with others. Be sure to focus your comments on the product.</label>
<textarea name="review_text" cols="60" rows="5" id="review-text"></textarea>
<div class="buttonRow forward"><input type="image" src="includes/templates/template_default/buttons/english/button_submit.gif" alt="Submit the Information" title=" Submit the Information " /></div>
<br class="clearBoth" />
<div id="reviewsWriteReviewsNotice" class="notice" align="left">NOTE: HTML tags are not allowed.<br />NOTE: Reviews require prior approval before they will be displayed</div>
<br class="clearBoth" />
</form>
当我填好数据后点击提交,没法实现插入数据库,因为我是这么判断的
if ($_POST['action']) {执行插入}
通过echo $_POST['action'];我发现$_POST['action']为空,于是
我试了 if (empty($_POST['action'])) {执行插入}
这个时候插入数据库成功
为什么???
你表单里并没有action的表单元素.
所以任何时间都为空.
<input type="hidden" value="review" id="action" name="action"/>
可以吗?
我学别人的,加了个一个unset($_POST)但是没用,还请指教一下
header("location: xxxx.php");
<form onsubmit="return fmChk(this)" method="post" action="<?php echo zen_href_link(zen_get_info_page($_GET['products_id']),'products_id=' . $_GET['products_id']).'#review' ?>" name="post_review" id="post_review">怎么跳转到本页地址?
header("location:本页地址");
or
echo '<script>window.location="本页地址";</script>';
location后面怎么跟变量啊
$url=getenv("HTTP_REFERER");
header("location:$url");
试试这个!
$url=getenv("HTTP_REFERER");
echo '<script>alert("你的提示");window.location="'.$url.'";</script>';