我正在寻找在我正在构建的博客底部添加反馈表单。
我已经创建了人们填写的表单来提交评论,如下所示。表单将插入到我添加到页面的短代码[post_review]中:
function post_review_shortcode() {
echo '<form action = "review_submitted_feedback.php" method = "post">';
echo '<fieldset>'; // Form Opening //
echo '<legend>';
echo '<p class = "S1">To post a review please enter your information below and hit submit! when you are done.</p>';
echo '</legend>';
// Please enter your name into the field below //
echo '<p><label>Name: <input type = "text" name ="name" size = "20" maxlength = "40" /></label></p>';
// Please enter your email address into the field below //
echo '<p><label>Email: <input type = "text" name = "email" size = "20" maxlength = "60" /></label></p>';
// Please add your review into the textarea below //
echo '<p><label>Review: <textarea name = "review" rows = "4" cols = "40"></textarea></label></p>';
echo '</fieldset>'; // Form Closing //
// Submit your information by clicking 'submit' //
echo '<p><input type ="submit" name="submit" value="Submit Review"/></p>';
echo '</form>'; // End of Code //
}
// A shortcode has now been created. Add [post_review] into a page to add the above form into the page //
add_shortcode('post_review','post_review_shortcode');
我遇到的问题是格式化并将此数据发送到我创建的管理页面(review_submitted_feedback)。
我为miss_submitted_feedback.php创建的内容如下:
<?php
echo "Name: <b>".$_POST['name']."</b></br>";
echo "Email: <b>".$_POST['email']."</b></br>";
echo "Review: <b>".$_POST['review']."</b></br>";
?>
如果有人可以告诉我需要添加的内容,或者在完成此过程时应该留意,我们将不胜感激。
此外,我希望以后能够添加批准(和发布)数据或删除数据的功能,所以如果有人有想法/指针,我很乐意收到。 :)
欢迎任何建议:)