Home › Forums › Quform WordPress › If I send the booking data to external URL: Fatal Error add_action()
- This topic has 10 replies, 2 voices, and was last updated 11 years, 5 months ago by Ally.
- AuthorPosts
- June 4, 2013 at 2:03 am #4668hhcwdParticipant
Hi,
this is the error message: Fatal error: Call to undefined function add_action() in …/booking.php on line 29
And this is the line 29: add_action(‘iphorm_post_process_1’, ‘mytheme_post_to_another_script’, 10, 1);
So I use the code from https://support.themecatcher.net/quform-wordpress/guides/integration/send-form-data-to-another-script.
I made a booking.php and insert this code:
<?php
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'checkInDate' => $_POST['.iphorm_1_1-input-day { }'], // Change iphorm_X_X to phone field unique ID
'checkInMonthYear' => $_POST['.iphorm_1_1-input-month .iphorm_1_1-input-year { }'], // Change iphorm_X_X to phone field unique ID
'checkOutDate' => $_POST['.iphorm_1_2-input-day { }'], // Change iphorm_X_X to phone field unique ID
'checkOutMonthYear' => $_POST['.iphorm_1_2-input-month .iphorm_1_2-input-year { }'], // Change iphorm_X_X to phone field unique ID
'numberOfAdults' => $_POST['iphorm_1_8'], // Change iphorm_X_X to name field unique ID
'numberOfChildren' => $_POST['iphorm_1_6'], // Change iphorm_X_X to email field unique ID
'numberOfRooms' => $_POST['iphorm_1_7'], // Change iphorm_X_X to phone field unique ID
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.intercontinental.com/redirect?path=rates&brandCode=ic&localeCode=en®ionCode=925&hotelCode=DPSHA&checkInDate&checkInMonthYear&checkOutDate&checkOutMonthYear&numberOfAdults&numberOfChildren&numberOfRooms&_PMID=99502222&blpu=true');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_1', 'mytheme_post_to_another_script', 10, 1);
?>
I’m not really sure if the line 19 (// Set URL and other appropriate options) is correct. The redirect URL is correct but I do not know if I need to enter the other parameters as CheckInDate etc..
But what am I doing wrong in line 29?
Can someone please help me?
Thank you very much.
Regards,
hhcwdJune 4, 2013 at 10:15 am #4674AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 4, 2013 at 2:34 pm #4680hhcwdParticipantHi and thanks for your help.
I have now integrated the code into the functions.php and get the same error message.
In the form I have made the setting:
On successful submit -> Redirect to another page
URL -> http://hotel-solution.net/ICRBali/wp-content/themes/HotelBooking/functions.phpfunctions.php with a new code.
<?php
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'checkInDate' => $_POST['iphorm_1_1']['day'],
'checkInMonthYear' => $_POST['iphorm_1_1']['month'] . ' ' . $_POST['iphorm_1_1']['year'],
'checkOutDate' => $_POST['iphorm_1_2']['day'],
'checkOutMonthYear' => $_POST['iphorm_1_2']['month'] . ' ' . $_POST['iphorm_1_2']['year'],
'numberOfAdults' => $_POST['iphorm_1_8'], // Change iphorm_X_X to name field unique ID
'numberOfChildren' => $_POST['iphorm_1_6'], // Change iphorm_X_X to email field unique ID
'numberOfRooms' => $_POST['iphorm_1_7'], // Change iphorm_X_X to phone field unique ID
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.intercontinental.com/redirect?path=rates&brandCode=ic&localeCode=en®ionCode=925&hotelCode=DPSHA&checkInDate&checkInMonthYear&checkOutDate&checkOutMonthYear&numberOfAdults&numberOfChildren&numberOfRooms&_PMID=99502222&blpu=true');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_1', 'mytheme_post_to_another_script', 10, 1);
/**
* This is your child theme functions file. In general, most PHP customizations should be placed within this
* file. Sometimes, you may have to overwrite a template file. However, you should consult the theme
* documentation and support forums before making a decision. In most cases, what you want to accomplish
* can be done from this file alone. This isn't a foreign practice introduced by parent/child themes. This is
* how WordPress works. By utilizing the functions.php file, you are both future-proofing your site and using
* a general best practice for coding.
*
* All style/design changes should take place within your style.css file, not this one.
*
* The functions file can be your best friend or your worst enemy. Always double-check your code to make
* sure that you close everything that you open and that it works before uploading it to a live site.
*
* @package Hotelbooking
* @subpackage Functions
*//* Adds the child theme setup function to the 'after_setup_theme' hook. */
add_action( 'after_setup_theme', 'supreme_child_theme_setup', 11 );
error_reporting(0);
/**
* Setup function. All child themes should run their setup within this function. The idea is to add/remove
* filters and actions after the parent theme has been set up. This function provides you that opportunity.
*
* @since 0.1.0
*/
require_once('wp-updates-theme.php');
new WPUpdateshotelbookingUpdater( 'http://wp-updates.com/api/1/theme', 146, basename(get_stylesheet_directory()) );
function supreme_child_theme_setup() {/* Get the theme prefix ("supreme"). */
$prefix = hybrid_get_prefix();/* Example action. */
// add_action( "{$prefix}_header", 'dotos_child_example_action' );/* Example filter. */
// add_filter( "{$prefix}_site_title", 'dotos_child_example_filter' );define('CHILD_THEME_PATH',get_stylesheet_directory());
define('CHILD_THEME_LIBRARY_PATH',get_stylesheet_directory().'/library/');
define('CHILD_DOMAIN','templatic');load_theme_textdomain(CHILD_DOMAIN);
load_textdomain( CHILD_DOMAIN, CHILD_THEME_PATH.'/languages/en_US.mo' );
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
global $blog_id,$upload_folder_path;
add_action('wp_head', 'hotelbooking_load_theme_stylesheet');
add_theme_support( 'theme-layouts', array(
'1c',
'2c-l',
'2c-r'
) );add_theme_support( 'supreme-slider');
if(get_option('upload_path') && !strstr(get_option('upload_path'),'wp-content/uploads'))
{
$upload_folder_path = "wp-content/blogs.dir/$blog_id/files/";
}else
{
$upload_folder_path = "wp-content/uploads/";
}
if(file_exists(CHILD_THEME_LIBRARY_PATH."widget_functions.php")){
require_once(CHILD_THEME_LIBRARY_PATH."widget_functions.php");
}
if(file_exists(CHILD_THEME_LIBRARY_PATH."custom_functions.php")){
require_once(CHILD_THEME_LIBRARY_PATH."custom_functions.php");
}
//UNREGISTER OR REMOVE UNUSED NAVIGATION MENU OF PARENT THEME START.
remove_action( 'init', 'supreme_register_menus' );
add_theme_support('hybrid-core-menus', array('secondary'));
//UNREGISTER OR REMOVE UNUSED NAVIGATION MENU OF PARENT THEME FINISH.
if(file_exists(CHILD_THEME_LIBRARY_PATH."auto_install/auto_install.php")){
include_once(CHILD_THEME_LIBRARY_PATH.'auto_install/auto_install.php');
}
remove_action('tmpl_single_post_pagination','single_post_pagination');
add_action('tmpl_single_post_pagination','BookingSystemPagination');
add_action('templ_before_post_title','remove_shareing_buttons_option',20);
add_action('widgets_init','remove_unneccessory_widgets',11);/*
Name : remove_shareing_buttons_option
Description : Sharing button + buynow button + sent to frd before content
*/
function remove_shareing_buttons_option()
{
if(is_single())
{
remove_action('tmpl_detail_page_custom_fields_collection','detail_fields_colletion');
add_action('templ_before_post_content','detail_fields_colletion');
add_action('templ_before_post_content','booking_detail_after_content');
}
if(is_archive() || is_tax() || is_tag()){
remove_action('tmpl_detail_page_custom_fields_collection','detail_fields_colletion');
add_action('templ_after_post_content','booking_detail_after_content');
}
add_image_size( 'home-page-slider', 980, 528, true );
remove_filter('the_content','view_sharing_buttons');add_action('templ_after_post_content','view_sharing_buttons');
remove_action('templ_send_friend_inquiry_email','send_friend_inquiry_email');
add_action('templ_after_post_content','send_friend_inquiry_email');}
//THEME COLOR SETTINGS START.
add_action( 'customize_register', 'hotelbooking_register_customizer_settings');
//THEME COLOR SETTINGS FINISH.
add_action("{$prefix}_before_main",'filter_for_images_on_category_pages');$taxnow = 'room_category';
if(isset($taxnow) && $taxnow== 'room_category'){
add_action($taxnow.'_edit_form_fields','booking_room_category_custom_fields_EditFields');
add_action($taxnow.'_add_form_fields','booking_room_category_custom_fields_AddFieldsAction');
add_action('edited_term','booking_room_category_custom_fields_AlterFields');
add_action('created_'.$taxnow,'booking_room_category_custom_fields_AlterFields');
}$taxnow_house = 'house_category';
if(isset($taxnow_house) && $taxnow_house== 'house_category'){
add_action($taxnow_house.'_edit_form_fields','booking_room_category_custom_fields_EditFields');
add_action($taxnow_house.'_add_form_fields','booking_room_category_custom_fields_AddFieldsAction');
add_action('edited_term','booking_room_category_custom_fields_AlterFields');
add_action('created_'.$taxnow_house,'booking_room_category_custom_fields_AlterFields');
}$taxnow_post = 'category';
if(isset($taxnow_post) && $taxnow_post== 'category'){
add_action($taxnow_post.'_edit_form_fields','booking_room_category_custom_fields_EditFields');
add_action($taxnow_post.'_add_form_fields','booking_room_category_custom_fields_AddFieldsAction');
add_action('edited_term','booking_room_category_custom_fields_AlterFields');
add_action('created_'.$taxnow_post,'booking_room_category_custom_fields_AlterFields');
}
add_action('admin_init','add_metabox_for_page_images');
add_action('tmpl_after_slider_title','hotel_booking_slider_link',10,2);
add_filter('custom_post_type_desscription_title','post_descrption_title',10,2);
}
if(!function_exists('post_descrption_title')){
function post_descrption_title($post_description,$post_type_label){
if($post_type_label == 'room'){
return __("Room Description",T_DOMAIN);
}elseif($post_type_label == 'house'){
return __("House Description",T_DOMAIN);
}
}
}if(!function_exists('add_metabox_for_page_images')){
function add_metabox_for_page_images(){
add_meta_box('hotelbooking_page_images','Custom Header Image','custom_header_image','page','normal','high');
add_meta_box('hotelbooking_page_images','Custom Header Image','custom_header_image','post','normal','high');
}
}
if(!function_exists('custom_header_image')){
function custom_header_image($post){
global $wp_query,$post;
$image = get_post_meta($post->ID,'custom_page_image',true);
echo '<input type="hidden" name="page_image_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';
$Html = '<div><label for="post_status">'.__("Header Image Url",DOMAIN).': </label>';
$Html .= '<input style="width:500px" id="header_image_url" class="" type="text" value="'.$image.'" name="header_image_url">
<div><small>'.__("Enter image url which you want to display on pages after menu header.",DOMAIN).'</small></div>
</div>';
echo $Html;
}
}
add_action('save_post','save_header_image_for_page');
if(!function_exists('save_header_image_for_page')){
function save_header_image_for_page($post_id){
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
global $wpdb;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify this came from the our screen and with proper authorization,
$other_post_type = $_POST['post_type'];// because save_post can be triggered at other times
if ( !wp_verify_nonce( $_POST['page_image_nonce'], basename(__FILE__) ) )
return $post_id;// Check permissions
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_id ) )
return;
}else{
if ( !current_user_can( 'edit_post', $post_id ) )
return;
}//find and save the data
$post_ID = $_POST['post_ID'];
$image = $_POST['header_image_url'];
update_post_meta($post_ID,'custom_page_image',$image);
}
}
if(!function_exists('filter_for_images_on_category_pages')){
function filter_for_images_on_category_pages(){
global $current_term,$wpdb,$wp_query,$post;
$category_image = '';
$category_name = '';
$current_post_type = get_post_type();
$category_object = $wp_query->get_queried_object();
if($category_object){
if(is_tax() && 'room_category' == $category_object->taxonomy){
$category_image = $category_object->cat_image;
$category_name = $category_object->name;
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s1.jpg';
}
}elseif(is_tax() && 'house_category' == $category_object->taxonomy){
$category_image = $category_object->cat_image;
$category_name = $category_object->name;
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s2.jpg';
}
}elseif((is_tax() || is_archive()) && 'category' == $category_object->taxonomy){
$category_image = $category_object->cat_image;
$category_name = $category_object->name;
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s3.jpg';
}
}elseif(is_single() && 'room' == $current_post_type){
$category_image = get_post_meta($post->ID,'room_house_image',true);
$category_name = $post->post_title;
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s4.jpg';
}
}elseif(is_single() && 'house' == $current_post_type){
$category_image = get_post_meta($post->ID,'room_house_image',true);
$category_name = $post->post_title;
if($category_image == "" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s5.jpg';
}
}elseif(is_single() && 'post' == $current_post_type){
$category_image = get_post_meta($post->ID,'custom_page_image',true);
$category_name = $post->post_title;
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s6.jpg';
}
}elseif(is_page()){
$category_name = $post->post_title;
$category_image = get_post_meta($post->ID,'custom_page_image',true);
if($category_image=="" || $category_image == " "){
$category_image = get_stylesheet_directory_uri().'/images/dummy/s9.jpg';
}
}else{
$category_name = '';
$category_image = '';
}
}
if($category_image!=""){
?>
<div class="main_header" style="background:url(<?php echo $category_image; ?>) no-repeat center top;">
<div class="main_header_in">
<div class="post-meta">
<h1><?php _e($category_name,'templatic');?></h1>
</div>
</div>
</div>
<?php
}
$IsDisplayBreadCrumbs = get_option('supreme_theme_settings');
if($IsDisplayBreadCrumbs['supreme_show_breadcrumb'] == 1){
if(!is_home()){
if ( current_theme_supports( 'breadcrumb-trail' ) && hybrid_get_setting('supreme_show_breadcrumb')) breadcrumb_trail( array( 'separator' => '»' ) );
}
}
}
}
//ADDED CODE FOR FAVICON ICON SETTINGS START.
add_action('admin_head', 'Hotelbookingfavocin_icon');
if(!function_exists('Hotelbookingfavocin_icon')){
function Hotelbookingfavocin_icon() {
$GetSupremeThemeOptions = get_option('supreme_theme_settings');
$GetFaviconIcon = $GetSupremeThemeOptions['supreme_favicon_icon'];
if($GetFaviconIcon!=""){
echo '<link rel="shortcut icon" href="' . $GetFaviconIcon . '" />';
}
}
}
//ADDED CODE FOR FAVICON ICON SETTINGS FINISH.
if(!function_exists('hotelbooking_load_theme_stylesheet')){
function hotelbooking_load_theme_stylesheet(){
include(get_stylesheet_directory().'/css/admin-style.php');
}
}if (is_admin())
{
//Remove theme layout post meta box //
if(!function_exists('hotelbooking_remove_theme_layout_meta_box')){
function hotelbooking_remove_theme_layout_meta_box()
{
global $post;
$post_types=get_post_types();
if($post->ID!="")
{
$page_template=get_post_meta($post->ID,'_wp_page_template',true);
if($page_template=='page-template_map.php' || $page_template=='page-template_form.php' || $page_template=='page-template_advanced_search.php')
{
remove_meta_box('theme-layouts-post-meta-box',$post_type,'side');
}
}
foreach($post_types as $post_type):
if($post_type!='post' && $post_type!='page' && $post_type!="attachment" && $post_type!="revision" && $post_type!="nav_menu_item"):
remove_meta_box('theme-layouts-post-meta-box',$post_type,'side');
endif;
endforeach;
}
}
//Add Meta Boxes for remove theme layout meta box //
add_action( 'add_meta_boxes', 'hotelbooking_remove_theme_layout_meta_box',11 );add_action('admin_head','hotelbooking_theme_layout_meta_box_script');
if(!function_exists('hotelbooking_theme_layout_meta_box_script')){
function hotelbooking_theme_layout_meta_box_script()
{
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {if(jQuery("#page_template").val() !='page-template_form.php' && jQuery("#page_template").val() !='page-template_map.php' && jQuery("#page_template").val() !='page-template_advanced_search.php'){
jQuery("#theme-layouts-post-meta-box").css('display','block');
}else{
jQuery("#theme-layouts-post-meta-box").css('display','none');}
jQuery("#page_template").change(function() {
var src = jQuery(this).val();
if(jQuery("#page_template").val() =='page-template_form.php' || jQuery("#page_template").val() =='page-template_map.php' || jQuery("#page_template").val() =='page-template_advanced_search.php'){
jQuery("#theme-layouts-post-meta-box").fadeOut(2000);
}else{
jQuery("#theme-layouts-post-meta-box").fadeIn(2000);
}
});
});
</script>
<?php
}
}}
function hotel_booking_slider_link($instance,$slider_form)
{
?>
<p>
<?php global $textbox_text2;
$textbox_text2=$slider_form->get_field_name('s1_text');
?>
<label for="<?php echo $slider_form->get_field_id('s1_text'); ?>">
<?php _e('Banner Slider Text2 1');?>
<input type="text" class="widefat" name="<?php echo $textbox_text2; ?>[]" value="<?php echo esc_attr($instance['s1_text'][0]); ?>">
</label>
</p>
<p>
<?php global $textbox_link;
$textbox_link=$slider_form->get_field_name('s1_link');
?>
<label for="<?php echo $slider_form->get_field_id('s1_link'); ?>">
<?php _e('Banner Slider Link 1');?>
<input type="text" class="widefat" name="<?php echo $textbox_link; ?>[]" value="<?php echo esc_attr($instance['s1_link'][0]); ?>">
</label>
</p><?php
}
add_action('tmpl_image_link','add_image_link_',10,3);
function add_image_link_($j,$instance,$slider_link)
{
$s1_link = ($instance['s1_link']);
$s1_text = ($instance['s1_text']);
global $textbox_link,$textbox_text2;
echo '<p>';
echo '<label>Banner Slider Text2 '.$j;
echo ' <input type="text" class="widefat" name="'.$textbox_text2.'[]" value="'.esc_attr($s1_text[($j - 1)]).'"></label>';
echo '</label>';
echo '</p>';
echo '<p>';
echo '<label>Banner Slider Link '.$j;
echo ' <input type="text" class="widefat" name="'.$textbox_link.'[]" value="'.esc_attr($s1_link[($j - 1)]).'"></label>';
echo '</label>';
echo '</p>';
}
remove_action('add_slider_submit','add_slider_submit_button');
add_action('add_slider_submit','tadd_slider_submit_button',10,4);
function tadd_slider_submit_button($instance,$textbox_name,$textbox_title,$textbox_link,$textbox_text2)
{
?>
<input value="Add Textbox" id="addButton" class="addButton" type="button" onclick="add_textbox('<?php echo $textbox_name;?>','<?php echo $textbox_title;?>','<?php echo $textbox_link;?>','<?php echo $textbox_text2;?>');"/>
<?php
}remove_action('admin_footer','multitext_box');
add_action('admin_footer','HB_multitext_box');
function HB_multitext_box()
{
global $textbox_name,$textbox_title,$textbox_link,$textbox_text2;
?>
<script type="application/javascript">
var counter = 2;
function add_textbox(name,title,link,text2)
{
var newTextBoxDiv = jQuery(document.createElement('div')).attr("class", 'TextBoxDiv' + counter);
newTextBoxDiv.html('<p><label>Banner Slider Title '+ counter + ' </label>'+'<input type="text" class="widefat" name="'+title+'[]" id="textbox' + counter + '" value="" ></p><p><label>Banner Slider TExt2 '+ counter + ' </label>'+'<input type="text" class="widefat" name="'+text2+'[]" id="textbox' + counter + '" value="" ></p><p><label>Banner Slider Link '+ counter + ' </label>'+'<input type="text" class="widefat" name="'+link+'[]" id="textbox' + counter + '" value="" ></p><p><label>Banner Slider Image '+ counter + ' full URL : </label>'+'<input type="text" class="widefat" name="'+name+'[]" id="textbox' + counter + '" value="" ></p>');
newTextBoxDiv.appendTo(".TextBoxesGroup");counter++;
}
function remove_textbox()
{
if(counter-1==1){
alert("you need one textbox required.");
return false;
}
counter--;
jQuery(".TextBoxDiv" + counter).remove();
}
</script>
<?php
}
add_action('tmpl_image_text_link','add_text2_link',10,2);
function add_text2_link($i,$instance)
{
$s1_link = empty($instance['s1_link']) ? '' : apply_filters('widget_s1_link', $instance['s1_link']);
$s1_text = empty($instance['s1_text']) ? '' : apply_filters('widget_s1_text', $instance['s1_text']);
echo '<a href="'.$s1_link[$i].'" class="sub-title">'.$s1_text[$i].'</a>';
}
?>
I have also tried to integrate the code into the middle of the functions.php, but then I get the error message, the following line is wrong.
add-action…
/* Adds the child theme setup function to the 'after_setup_theme' hook. */
add_action( 'after_setup_theme', 'supreme_child_theme_setup', 11 );
error_reporting(0);In the functions.php from the parent them I find this:
* Child themes should do their setup on the 'after_setup_theme' hook with a priority of 11 if they want to
* override parent theme features. Use a priority of 9 if wanting to run before the parent theme.
Does this have something to do with my error message?Please help me if you can. I’m in great difficulties. If I until Monday the whole website do not finish, then I get in big trouble with the customer.
My biggest problem is that my boss until next Wednesday 12 Jun, is back in the office and he has apparently forgotten his cell phone, because it is in the office.
I can not reach him and all the responsibility is on me. But I just can not find a solution.
And Monday 10 Jun, I have to put the website online.Please, please.
Thank You so much.
Regards,
hhcwdJune 5, 2013 at 10:43 am #4689AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 5, 2013 at 10:32 pm #4718hhcwdParticipantAlly
Thank you for your help.
Unfortunately, I have to confess, that I not really know what to make and how to use the information about the hook function.
I have searched everything here in the forum and found some posts but I’m not progressed.I know that all my questions no longer have to do with the support. And I am more than just grateful for your help.
Could you please give me an example or any website where I can find out about it. Google gives a lot of information but most do not fit into what I need.
In WordPress I have the prepared the config for debug and also created a debug.log file. But without the hook function is of course nothing in the debug file.
If I don’t too much pester and you could give me an example of what or where I have to do, I’d be infinitely grateful for that.
If you don’t do this I can understand that too. Finally, such questions are not include in the support.
Thank you for all Ally.
Regards,
hhcwdJune 6, 2013 at 10:13 am #4735AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 7, 2013 at 3:08 pm #4769hhcwdParticipantI can’t d
June 7, 2013 at 3:11 pm #4770hhcwdParticipantHi Ally,
I do not know why that is, but even if I login on the support page I get the message ‘You do not have permission to view this content. ‘
But I can read your answers in my mail account.
When submitting the form, I get no error message. But it also happens nothing further. I stay on the same page and will not be redirected.
Is there a way that I give you my login for WordPress and you look at the form?
Thank You.
Warm regards,
hhcwdPS: Sorry for the last, short post 🙁
June 8, 2013 at 4:44 pm #4782AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 9, 2013 at 2:16 am #4785hhcwdParticipantHi Ally,
ok can’t use the POST method. So, I have changed the code in functions.php, taken out the POST method and used GET. Is that correct?
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$get = array(
'checkInDate' => $_GET['iphorm_1_1']['day'],
'checkInMonthYear' => $_GET['iphorm_1_1']['month'] . ' ' . $_GET['iphorm_1_1']['year'],
'checkOutDate' => $_GET['iphorm_1_2']['day'],
'checkOutMonthYear' => $_GET['iphorm_1_2']['month'] . ' ' . $_GET['iphorm_1_2']['year'],
'numberOfAdults' => $_GET['iphorm_1_8'], // Change iphorm_X_X to name field unique ID
'numberOfChildren' => $_GET['iphorm_1_6'], // Change iphorm_X_X to email field unique ID
'numberOfRooms' => $_GET['iphorm_1_7'], // Change iphorm_X_X to phone field unique ID
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.intercontinental.com/redirect?path=rates&brandCode=ic&localeCode=en®ionCode=925&hotelCode=DPSHA&checkInDate&checkInMonthYear&checkOutDate&checkOutMonthYear&numberOfAdults&numberOfChildren&numberOfRooms&_PMID=99502222&blpu=true');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($get));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_1', 'mytheme_post_to_another_script', 10, 1);But what I have to do under the settings. Should I choose ‘Redirect to another page’?
And if yes, shall I then enter the redirect URL from the function.php there?
// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.intercontinental.com/redirect?path=rates&brandCode=ic&localeCode=en®ionCode=925&hotelCode=DPSHA&checkInDate&checkInMonthYear&checkOutDate&checkOutMonthYear&numberOfAdults&numberOfChildren&numberOfRooms&_PMID=99502222&blpu=true');Ally thank you so much for you help and your patience with me.
Warm regards,
hhcwdJune 10, 2013 at 9:02 am #4789AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.