Need help to troubleshoot php (Warning: Missing argument 11 …)

I have had to modify some php code to suit my needs and my forms page is now spitting out this

“Warning: Missing argument 11 for cash_payment(), called in
/…/wp-content/plugins/inkappointmentpro/ink-admin/apt-form.php
on line 66 and defined in
/…/wp-content/plugins/inkappointmentpro/ink-admin/appointments-form/getway/paypal-page.php
on line 26”

Read More

when submitting the form.

Here are the two files in question. Can someone please help? I’m not a programmer, just a guy who manages to fuddle his way through this stuff usually.

paypal-page.php

    <?php
/**
 *   Paypal Transaction 
 * @ gateway_sandbox
 * */
function gateway_sandbox() {
    if (isset($_POST['submit'])) {
        $db_obj = new Apt_DB();
        if (file_exists($db_obj->dir . "ink-admin/appointments-form/getway/paypal/paypal_sandbox.php")) {
            include_once($db_obj->dir . "ink-admin/appointments-form/getway/paypal/paypal_sandbox.php");
        }
    }
}
/**
 *   Paypal Transaction 
 * @ gateway_paypal
 * */
function gateway_paypal() {
    if (isset($_POST['submit'])) {
        $db_obj = new Apt_DB();
        if (file_exists($db_obj->dir . "ink-admin/appointments-form/getway/paypal/paypal_response.php")) {
            include_once($db_obj->dir . "ink-admin/appointments-form/getway/paypal/paypal_response.php");
        }
    }
}
function cash_payment($sr_apt_id, $sr_apt_time, $sr_apt_date, $sr_apt_persion_name, $sr_apt_email, $sr_apt_phone, $sr_msg, $sr_apt_message, $sr_apt_ugs, $sr_apt_lawnarea, $sr_data_rand) {
    global $wpdb;
    $db_obj = new Apt_DB();
    $apt_service = $db_obj->tbl_service;
    $appointment_data = $db_obj->tbl_appointment_data;
    $sql_srdata = $wpdb->get_row("SELECT * FROM $apt_service Where service_id='$sr_apt_id'", ARRAY_N);
    $cr_code = get_option('apt_currency_code');
    $price = $sql_srdata[2] . '&nbsp' . $cr_code . '&nbsp- Pay Cash Later';
    $priceshow = $sql_srdata[2] . '' . $cr_code;
    $apt_txn_booking_date = date("F j, Y, g:i A");
    $apt = new AptService();
    if (isset($_POST['submit'])) {
        $sql_val = $wpdb->get_row("SELECT * FROM $appointment_data Where apt_data_rand='$sr_data_rand'");
        if (!$sql_val) {
            $apt->insert_data_frontend($sr_apt_id, $sr_apt_date, $sr_apt_persion_name, $sql_srdata[1], $sr_apt_time, $price, $sr_apt_email, $sr_apt_phone, $sr_msg, $sr_apt_message, $sr_apt_ugs, $sr_apt_lawnarea, $sr_data_rand, $apt_txn_booking_date, 'cash');
            echo '<p>Your appointment request has be submitted successfully. We will email or phone you with confirmation.</br>Thank you for choosing Saskatoon ProLawn.</p>';
            /**
             * Send transaction notification to admin or client
             */
            $transaction_details = '';
            $personname = $sr_apt_persion_name;
            $servicename = $sql_srdata[1];
            $aptime = $sr_apt_time;
            $aptdate = $sr_apt_date;
            $aptmessage = $sr_apt_message;
            $aptugs = $sr_apt_ugs;
            $aptlawnarea =$sr_apt_lawnarea;
            $aptemail = $sr_apt_email;
            $url = site_url();
            $adminurl = str_replace('http://', '', $url);
            $transaction_details .= "Hello  $personname,r";
            $transaction_details .= "r";
            $transaction_details .= "Your appointment request has been received, below are the details of your request. r r";
            $transaction_details .= "Service Name: $servicename r";
            $transaction_details .= "Appointment Date: $aptdater";
            $transaction_details .= "Appointment Time: $aptimer";
            $transaction_details .= "Contact Phone: $aptphoner";
            $transaction_details .= "Address: $aptmessager";
            $transaction_details .= "Underground Sprinklers Present: $aptugsr";
            $transaction_details .= "Lawn Area to be Done: $aptlawnarear r";
            $transaction_details .= "Thanks for choosing Saskatoon ProLawn.r";
            $transaction_details .= "When I confirm the date and time, I will send another email or contact you at the phone number provided. Please add us r r";
            $transaction_details .= "Warm Regards,r";
            $transaction_details .= "Shaner r";
            $transaction_details .= "$adminurlr";
            $subject = __("Your Appointment Request Has Been Received", 'appointment');
            $filecontent = $transaction_details;
            $admin_email = get_option('admin_email');
            $headers = 'From: ' . $admin_email . ' <' . $aptemail . '>' . "rn" . 'Reply-To: ' . $admin_email;
            $header = 'From: ' . $aptemail . ' <' . $admin_email . '>' . "rn" . 'Reply-To: ' . $aptemail;
            //mail($to_admin, $subject, $filecontent, $headers);
            wp_mail($aptemail, $subject, $filecontent, $headers); //email to user
            wp_mail($admin_email, $subject, $filecontent, $header); //email to admin                                
        } //refresh value if end
    } //submit data if end
}
//function end

apt-form.php

<?php
add_shortcode('ink-appointments-form', 'ink_appoitment');

function ink_appoitment() {
    ?>
    <script>
        jQuery.noConflict();
        jQuery(function () {
            jQuery("#aptcal").datepicker();
            jQuery("#aptcal").datepicker("option", "minDate", 0);
        });
    </script>
    <?php
    $db_obj = new Apt_DB();
    global $wpdb;
    $cpt_true = false;
    $apt_service = $db_obj->tbl_service;
    $check_apt = isset($_POST['chk_apt']) ? $_POST['chk_apt'] : null;
    $cpt_apt = isset($_POST['apt_cpt']) ? $_POST['apt_cpt'] : null;
    if ($check_apt != $cpt_apt) {
        $cpt_true = true;
    }
    $msg = '';
    $captcha_details = '';
    $is_captcha_on = get_option('cpt_enable');
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $is_captcha_on == 'on') {
        $recaptcha = $_POST['g-recaptcha-response'];
        if (!empty($recaptcha)) {
            $secret = get_option('apt_recaptcha_private');
            $secret = empty($secret) ? 'Google secret key' : $secret;
            $captcha_data = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secret . "&response=" . $_POST['g-recaptcha-response']);
            $response = json_decode($captcha_data, TRUE);
            if ($response['success']) {
                $captcha_details = true;
            } else {
                $captcha_details = false;
                $error = array_search("invalid-input-secret", $response['error-codes']);
                if ($error == 0) {
                    $msg = "Please enter correct reCAPTCHA key.";
                } else {
                    $msg = "Please re-enter your reCAPTCHA.";
                }
            }
        } else {
            $captcha_details = false;
            $msg = "Please re-enter your reCAPTCHA.";
        }
    }
    $blank_data = "";
    if ((isset($_POST['submit']) && $is_captcha_on != 'on' && $cpt_true == false ) || (isset($_POST['submit']) && $captcha_details == true)) {
        $_POST['time'];
        if (($_POST['time'] == 'notavi') || ($_POST['service_select'] == 'notavi')) {
            echo "<p>Please Insert All data.</p>";
            $blank_data = true;
        } else {
            $blank_data = false;
            echo $badUrl = (isset($_POST['sr_price'])) ? $_POST['sr_price'] : null;
            if (get_option('apt_paypal') == "sandbox") {
                gateway_sandbox();
            } elseif (get_option('apt_paypal') == "paypal") {
                gateway_paypal();
            } elseif (get_option('apt_paypal') == "cash") {
                $datechange = $_POST['aptcal'];
                $dateformat = explode('/', $datechange);
                $newaptdate = $dateformat[1] . '/' . $dateformat[0] . '/' . $dateformat[2];
                cash_payment($_POST['service_select'], $_POST['time'], $newaptdate, $_POST['fname'], $_POST['aptemail'], $_POST['aptphone'], $_POST['aptmessage'], $_POST['aptugs'], $_POST['aptlawnarea'], $_POST['random']);
            }
        }
    }
    if (isset($_GET['paypal-trans'])) {
        ink_apt_trans_display();
    } else {
        $ruri = $_SERVER['REQUEST_URI'];
        $sname = $_SERVER['SERVER_NAME'];
        $fullpath = 'http://' . $sname . $ruri;
        update_option('return_apt_url', $fullpath);
        $br = new AptService();
        $iechk = $br->ink_browser();
        if ((!isset($_POST['submit'])) || ($check_apt != $cpt_apt) || ($captcha_details == false) || ($blank_data == true)) {
            ?>
            <div class="ink-container">
                <div class="inkappointment_wrapper">
                    <div class="inkappointment_form_top">
                    </div>
                    <div class="inkappointment_form_wrapper">
                        <form method="post" action="" id="ink-form" name="ink-form" class="ink-form" >

                            <header id="ink-header" class="ink-info">
                            </header>
                            <ul class="inkappform">
                                <li class="textheading"><h2><span class="msg_text"><?php echo get_option('apt_form_head'); ?></span></h2></li>
                                <li class="textfname"><input type="text" name="fname" id="fname" class="inktext inklarge inkrequired"   placeholder="Name"  maxlength="100" />
                                    <label id="apt_error"> </label>
                                </li>
                                <li class="textaptemail"><input type="email" name="aptemail" id="aptemail" class="inktext inklarge inkrequired" placeholder="Email"  maxlength="100" /></li>
                                <li class="textaptphone"><input type="text" name="aptphone" id="aptphone" class="inktext inklarge" placeholder="Contact Number"  maxlength="12” /></li>
                                <li class="textfixdate"><span class="fix_date"><?php echo get_option('apt_fix_date'); ?></span></li>
                                <li class="select_item"><select  id="service_select" name="service_select" class="inktext inklarge inkrequired" >
                                        <option  value="noavi">Select Service</option>
                                        <?php
                                        $showts = $wpdb->get_results("SELECT * FROM $apt_service ", ARRAY_A);
                                        foreach ($showts as $timerow) {
                                            ?>
                                            <option  value="<?php echo $timerow['service_id']; ?>"><?php echo $timerow['service_name']; ?></option>
                                        <?php } ?> </select></li>
                                <li class="textaptcal"><input type="text" name="aptcal" id="aptcal" class="dateField inktext inklarge"  placeholder="Select Date" /></li>
                                <li class="select_item"><select id="time" name="time" class="inktext inklarge inkrequired">
                                        <option value="notavi">Select Time</option>  </select></li>
                                <li class="textfixdate"><span class="fix_date">Do you have underground Sprinklers?</span></li>
                                <li class="textfixdate"><span class="fix_date"><input type="radio" name="aptugs" id="aptugs" value="yes" checked>Yes <input type="radio" name="aptugs" id="aptugs"” value="no">No</span></li>
                                <li class="textfixdate"><span class="fix_date">Area Required</span></li>
                                <li class="textfixdate"><span class="fix_date"><input type="radio" name="aptlawnarea" id="aptlawnarea" value="frontback" checked>Front+Back <br> <input type="radio" name="aptlawnarea" id="aptlawnarea" value="front">Front Only <br> <input type="radio" name="aptlawnarea" id="aptlawnarea" value=“back”>Back Only</span></li>
                                <li class="textfixdate"><span class="fix_date"><?php echo get_option('apt_custom_msg'); ?></span></li>
                                <li class="textaptmessage"><textarea name="aptmessage" id="aptmessage" class="inktext inklarge inkrequired" maxlength="255" rows="3" cols="50" placeholder="Address (required)" ></textarea></li>
                                <?php if ($is_captcha_on === 'on') { ?><li>
                                        <div class="g-recaptcha-div"><div class="g-recaptcha" data-sitekey="<?php
                                            if (get_option('apt_recaptcha_public')) {
                                                echo get_option('apt_recaptcha_public');
                                            } else {
                                                echo 'Google Public Key';
                                            }
                                            ?>"></div>
                                        </div>
                                        <span class='msg'><?php echo $msg; ?></span>
                                    </li>
                                <?php } ?>
                                <li class="submit_bg">
                                    <input type="hidden" name="random" id="random"  value="<?php echo rand(); ?>"/>
                                    <input type="submit" name="submit" id="submit"  class='ink-submit inkrequired' value="Book Appointment"/>  </li>
                            </ul>
                        </form>
                    </div>
                    <div class="inkappointment_form_bottom">
                    </div>
                </div>
            </div>
            <?php
        } //submit not set
    }
}

Related posts

Leave a Reply

2 comments

  1. you have missing one parameter for the following function: cash_payment()

    Function Definition having 11 parameters:

    function cash_payment($sr_apt_id, $sr_apt_time, $sr_apt_date, $sr_apt_persion_name, $sr_apt_email, $sr_apt_phone, $sr_msg, $sr_apt_message, $sr_apt_ugs, $sr_apt_lawnarea, $sr_data_rand) {}
    

    Function calling 10 parameters:

    cash_payment($_POST['service_select'], $_POST['time'], $newaptdate, $_POST['fname'], $_POST['aptemail'], $_POST['aptphone'], $_POST['aptmessage'], $_POST['aptugs'], $_POST['aptlawnarea'], $_POST['random']);
    

    If you don’t have any 11th parameters of any values against parameters than pass the empty string but no of parameters in definition is always equal to no of parameters of calling a function.

  2. I think this error comes due to missing argument in cash_payment function, please check all fields of this function.
    cash_payment($_POST[‘service_select’], $_POST[‘time’], $newaptdate, $_POST[‘fname’], $_POST[‘aptemail’], $_POST[‘aptphone’], $_POST[‘aptmessage’], $_POST[‘aptugs’], $_POST[‘aptlawnarea’], $_POST[‘random’]);
    }
    Please try to echo all fields and check if you found any of null value.