我需要这个联系表单重新定位在wordpress中创建的新页面,此时它保持在同一个网址上我知道我必须在某处添加页眉和页面网址,但只需要一些帮助就可以放置它。
<?php
$result = purple_handle_payback();
get_header();
the_post();
?>
<hgroup class="header-area discover-header group">
<h1><?php the_title(); ?></h1>
</hgroup>
<div class="upload-page">
<div class="upload-area group">
<div class="upload-form group">
<?php the_content(); ?>
<?php if ( empty( $result ) || ( $error = ( $result instanceof Error ) ) ): ?>
<p class="error"><?php if ( $error ) echo $result->getMessage(); ?></p>
<form class="group" method="POST" action="<?php the_permalink(); ?>">
<h5>Your details</h5>
<div>
<?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_FIRST_NAME] ) ): ?>
<?php $value = $_SESSION['payback'][Payback::FIELD_FIRST_NAME]; ?>
<?php elseif ( !empty( $_POST[Payback::FIELD_FIRST_NAME] ) ): ?>
<?php $value = $_POST[Payback::FIELD_FIRST_NAME]; ?>
<?php else: ?>
<?php $value = ''; ?>
<?php endif; ?>
<input type="text" name="<?php echo Payback::FIELD_FIRST_NAME; ?>" placeholder="First name..." value="<?php echo $value; ?>" autocomplete="off">
</div>
<div>
<?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_LAST_NAME] ) ): ?>
<?php $value = $_SESSION['payback'][Payback::FIELD_LAST_NAME]; ?>
<?php elseif ( !empty( $_POST[Payback::FIELD_LAST_NAME] ) ): ?>
<?php $value = $_POST[Payback::FIELD_LAST_NAME]; ?>
<?php else: ?>
<?php $value = ''; ?>
<?php endif; ?>
<input type="text" name="<?php echo Payback::FIELD_LAST_NAME; ?>" placeholder="Last name..." value="<?php echo $value; ?>" autocomplete="off">
</div>
<div>
<?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_EMAIL] ) ): ?>
<?php $value = $_SESSION['payback'][Payback::FIELD_EMAIL]; ?>
<?php elseif ( !empty( $_POST[Payback::FIELD_EMAIL] ) ): ?>
<?php $value = $_POST[Payback::FIELD_EMAIL]; ?>
<?php else: ?>
<?php $value = ''; ?>
<?php endif; ?>
<input type="email" name="<?php echo Payback::FIELD_EMAIL; ?>" placeholder="Email address..." value="<?php echo $value; ?>" autocomplete="off">
</div>
<div>
<?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_TEL] ) ): ?>
<?php $value = $_SESSION['payback'][Payback::FIELD_TEL]; ?>
<?php elseif ( !empty( $_POST[Payback::FIELD_TEL] ) ): ?>
<?php $value = $_POST[Payback::FIELD_TEL]; ?>
<?php else: ?>
<?php $value = ''; ?>
<?php endif; ?>
<input type="tel" name="<?php echo Payback::FIELD_TEL; ?>" placeholder="Contact number..." value="<?php echo $value; ?>" autocomplete="off">
</div>
<br>
<h5>Their details</h5>
<div>
<input type="text" name="<?php echo Payback::FIELD_FRIEND_FIRST_NAME; ?>" placeholder="First name..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_FIRST_NAME] ) ) echo $_POST[Payback::FIELD_FRIEND_FIRST_NAME]; ?>" autocomplete="off">
</div>
<div>
<input type="text" name="<?php echo Payback::FIELD_FRIEND_LAST_NAME; ?>" placeholder="Last name..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_LAST_NAME] ) ) echo $_POST[Payback::FIELD_FRIEND_LAST_NAME]; ?>" autocomplete="off">
</div>
<div>
<input type="email" name="<?php echo Payback::FIELD_FRIEND_EMAIL; ?>" placeholder="Email address..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_EMAIL] ) ) echo $_POST[Payback::FIELD_FRIEND_EMAIL]; ?>" autocomplete="off">
</div>
<div>
<input type="tel" name="<?php echo Payback::FIELD_FRIEND_TEL; ?>" placeholder="Contact number..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_TEL] ) ) echo $_POST[Payback::FIELD_FRIEND_TEL]; ?>" autocomplete="off">
</div>
<div>
<input type="text" name="<?php echo Payback::FIELD_FRIEND_ROLE; ?>" placeholder="Current role..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_ROLE] ) ) echo $_POST[Payback::FIELD_FRIEND_ROLE]; ?>" autocomplete="off">
</div>
<input type="submit" value="Finish" name="<?php echo Payback::FIELD_SUBMIT; ?>" width="27" height="23">
</form>
<?php else: ?>
<p>Thank you. We'll get back to you shortly.</p>
<?php endif; ?>
</div>
<?php get_sidebar( 'payback' ); ?>
</div>
</div>
<?php get_footer(); ?>
我已经添加了联系表单的全部代码,所以我希望它有所帮助
谢谢你们
任何帮助都会得到很大的帮助
答案 0 :(得分:1)
最有可能的问题在于:
<form class="group" method="POST" action="<?php the_permalink(); ?>">
提交表单后,action
属性会告诉浏览器提交表单的位置。
在您的情况下,the_permalink()
是一个wordpress功能,可以打印出当前页面的URL。