//成功提交表单后,我将如何重定向此页面,将用户带到主页?这是网站:http://shambas.co.ke/shambaz/submit-property/
<?php
if($submitted_successfully){
$submit_message = get_option('theme_submit_message');
alert( __('Success:','framework'), $submit_message );
}
elseif($updated_successfully){
alert( __('Success:','framework'),__('Property updated successfully!','framework') );
}
else{
/* if passed parameter is properly set to edit property */
if(isset($_GET['edit_property']) && !empty($_GET['edit_property'])){
$edit_property_id = intval(trim($_GET['edit_property']));
$target_property = get_post($edit_property_id);
/* check if passed id is a proper property post */
if( !empty( $target_property ) && ( $target_property->post_type == 'property' ) ){
// Check Author
global $current_user;
get_currentuserinfo();
/* check if current logged in user is the author of property */
if( $target_property->post_author == $current_user->ID ){
$post_meta_data = get_post_custom( $target_property->ID );
?>
<form id="submit-property-form" class="submit-form" enctype="multipart/form-data" method="post">
<div class="row-fluid">
<div class="span6">
<div class="form-option">
<label for="title"><?php _e('Property Title','framework'); ?></label>
<input id="title" name="title" type="text" class="required" value="<?php echo $target_property->post_title; ?>" title="<?php _e( '* Please provide property title!', 'framework'); ?>" autofocus required/>
</div>
<div class="form-option">
<label for="description"><?php _e('Property Description','framework'); ?></label>
<textarea name="description" id="description" cols="30" rows="5"><?php echo $target_property->post_content; ?></textarea>
</div>
<div class="form-options-container clearfix">
<div class="form-option ">
<label for="city"><?php _e('Location', 'framework'); ?></label>
<span class="selectwrap">
<select name="city" id="city" class="search-select">
<?php edit_form_hierarchichal_options( $target_property->ID, 'property-city'); ?>
</select>
</span>
</div>
<div class="form-option right">
<label for="status"><?php _e('Status', 'framework'); ?></label>
<span class="selectwrap">
<select name="status" id="status" class="search-select">
<?php edit_form_taxonomy_options( $target_property->ID, 'property-status'); ?>
</select>
</span>
</div>
<div class="form-option">
<label for="price"><?php _e('Price','framework'); ?></label>
<input id="price" name="price" type="text" value="<?php if( isset($post_meta_data['REAL_HOMES_property_price']) ){ echo $post_meta_data['REAL_HOMES_property_price'][0]; } ?>" title="<?php _e( '* Please provide the value in only digits!', 'framework'); ?>" />
</div>
<div class="form-option right">
<label for="size"><?php _e('Property Size','framework'); ?></label>
<input id="size" name="text" type="text" value="<?php if( isset($post_meta_data['REAL_HOMES_property_size']) ){ echo $post_meta_data['REAL_HOMES_property_size'][0]; } ?>" title="<?php _e( '* Please provide the value in only digits!', 'framework'); ?>" />
</div>
</div>
<div class="form-option">
<label for="featured"><?php _e('Mark this Property as Featured','framework'); ?></label>
<input id="featured" name="featured" type="checkbox" <?php if( isset($post_meta_data['REAL_HOMES_featured']) && $post_meta_data['REAL_HOMES_featured'][0] == 1 ){ echo 'checked';} ?>/>
</div>
</div>
<div class="span6">
<div class="form-option">
<label for="address"><?php _e('Address', 'framework'); ?></label>
<input type="text" class="required" name="address" id="address" value="<?php if( isset( $post_meta_data['REAL_HOMES_property_address'] ) ){ echo $post_meta_data['REAL_HOMES_property_address'][0]; } ?>" title="<?php _e( '* Please provide a property address!', 'framework'); ?>" required/>
<div class="map-wrapper">
<button class="real-btn goto-address-button" type="button" value="address"><?php _e( 'Find Address','framework' ); ?></button>
<div class="map-canvas"></div>
<input type="hidden" name="location" class="map-coordinate" value="<?php if( isset( $post_meta_data['REAL_HOMES_property_location'] ) ){ echo $post_meta_data['REAL_HOMES_property_location'][0]; } ?>" />
</div>
</div>
<div class="form-option">
<label for="featured-image"><?php _e('Property Featured Image','framework'); ?></label>
<div id="featured-thumb-container" class="clearfix">
<?php
if( has_post_thumbnail( $target_property->ID ) ){
echo '<div class="gallery-thumb">';
echo get_the_post_thumbnail( $target_property->ID, 'thumbnail' );
echo '<a class="remove-featured-image" data-property-id="'.$target_property->ID.'" href="'. site_url("/wp-admin/admin-ajax.php") .'" ><i class="fa fa-trash-o"></i></a>';
echo '<span class="loader"><i class="fa fa-spinner fa-spin"></i></span>';
echo '</div>';
}
?>
</div>
<div id="featured-file-container" class="<?php if(has_post_thumbnail( $target_property->ID )){ echo "hidden"; }?>" >
<input id="featured-image" name="featured_image" type="file" title="<?php _e( '* Please provide image with proper extension! Only .jpg .gif and .png are allowed.!', 'framework'); ?>" class="image required" required/>
<div class="field-description">
<?php _e('Image should have minimum width of 770px and minimum height of 386px. ( Bigger image will be cropped automatically )','framework'); ?>
</div>
</div>
</div>
<div class="form-option">
<label><?php _e('Gallery Images','framework'); ?></label>
<div id="gallery-thumbs-container" class="clearfix">
<?php
$thumbnail_size = 'thumbnail';
$properties_images = rwmb_meta( 'REAL_HOMES_property_images', 'type=plupload_image&size='.$thumbnail_size, $target_property->ID );
if( !empty($properties_images) ){
foreach( $properties_images as $prop_image_id=>$prop_image_meta ){
echo '<div class="gallery-thumb">';
echo '<img src="'.$prop_image_meta['url'].'" alt="'.$prop_image_meta['title'].'" />';
echo '<a class="remove-image" data-property-id="'.$target_property->ID.'" data-gallery-img-id="'.$prop_image_id.'" href="'. site_url("/wp-admin/admin-ajax.php") .'" ><i class="fa fa-trash-o"></i></a>';
echo '<span class="loader"><i class="fa fa-spinner fa-spin"></i></span>';
echo '</div>';
}
}
?>
</div>
<label><?php _e('Add more images to gallery','framework'); ?></label>
<div id="gallery-images-container">
<div class="controls-holder"><input class="gallery-image image" name="gallery_image_1" type="file" /></div>
</div>
<button id="add-more" class="real-btn"><?php _e('Add More','framework'); ?></button>
<div class="field-description">
<?php _e('Provide images for gallery on property detail page. Images should have minimum width of 770px and minimum height of 386px. ( Bigger images will be cropped automatically )','framework'); ?>
</div>
</div>
<div class="form-option">
<label><?php _e('What to display in agent information box ?','framework');?></label>
<div class="agent-options">
<input id="agent_option_none" type="radio" name="agent_display_option" value="none" <?php if( isset($post_meta_data['REAL_HOMES_agent_display_option']) && ($post_meta_data['REAL_HOMES_agent_display_option'][0] == "none") ){ echo "checked"; } ?> />
<label for="agent_option_none"><?php _e('None','framework'); ?></label> <small><?php _e('( Agent information box will not be displayed )','framework'); ?></small>
<br/>
<input id="agent_option_profile" type="radio" name="agent_display_option" value="my_profile_info" <?php if( isset($post_meta_data['REAL_HOMES_agent_display_option']) && ($post_meta_data['REAL_HOMES_agent_display_option'][0] == "my_profile_info") ){ echo "checked"; } ?> />
<label for="agent_option_profile"><?php _e('My profile information','framework');?></label> <small> <a href="<?php echo admin_url( 'profile.php' ); ?>" target="_blank"><?php _e('( You can add your profile information here )','framework');?></a></small>
<br/>
<input id="agent_option_agent" type="radio" name="agent_display_option" value="agent_info" <?php if( isset($post_meta_data['REAL_HOMES_agent_display_option']) && ($post_meta_data['REAL_HOMES_agent_display_option'][0] == "agent_info") ){ echo "checked"; } ?> />
<label for="agent_option_agent"><?php _e('Display an agent\'s information','framework'); ?></label>
<select name="agent_id" id="agent-selectbox">
<?php generate_posts_list('agent',$post_meta_data['REAL_HOMES_agents'][0]); ?>
</select>
</div>
</div>
<div class="form-option">
<?php wp_nonce_field( 'submit_property', 'property_nonce' ); ?>
<input type="hidden" name="action" value="update_property"/>
<input type="hidden" name="property_id" value="<?php echo $target_property->ID; ?>"/>
<input type="submit" value="<?php _e('Submit Property','framework');?>" class="real-btn" />
</div>
答案 0 :(得分:1)
您是否尝试过使用
header("location:thepagethatyouwantreach.php");
如果表格正确提交了吗?
//controlls
/if submission it's ok
header("location:thepagethatyouwantreach.php"); //redirect the user