需要帮助来解决php问题(警告:缺少参数11 ...)

时间:2015-04-13 08:32:38

标签: php wordpress forms warnings

我不得不修改一些PHP代码以满足我的需要,我的表单页面现在正在吐出这个

  

“警告:缺少参数11 for cash_payment(),调用   /.../wp-content/plugins/inkappointmentpro/ink-admin/apt-form.php   在第66行并在中定义   /.../wp-content/plugins/inkappointmentpro/ink-admin/appointments-form/getway/paypal-page.php   在第26行“

提交表单时。

以下是有问题的两个文件。有人可以帮忙吗?我不是一个程序员,只是一个经常通过这些东西挣扎的人。

贝宝-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: $aptdate\r";
            $transaction_details .= "Appointment Time: $aptime\r";
            $transaction_details .= "Contact Phone: $aptphone\r";
            $transaction_details .= "Address: $aptmessage\r";
            $transaction_details .= "Underground Sprinklers Present: $aptugs\r";
            $transaction_details .= "Lawn Area to be Done: $aptlawnarea\r \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 .= "Shane\r \r";
            $transaction_details .= "$adminurl\r";
            $subject = __("Your Appointment Request Has Been Received", 'appointment');
            $filecontent = $transaction_details;
            $admin_email = get_option('admin_email');
            $headers = 'From: ' . $admin_email . ' <' . $aptemail . '>' . "\r\n" . 'Reply-To: ' . $admin_email;
            $header = 'From: ' . $aptemail . ' <' . $admin_email . '>' . "\r\n" . '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

易于-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
    }
}

2 个答案:

答案 0 :(得分:0)

您缺少以下函数的一个参数:cash_payment()

功能定义有11个参数:

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) {}

调用10个参数的函数:

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

如果对参数的任何值没有任何第11个参数,则传递空字符串,但定义中的参数总是等于调用函数的参数no。

答案 1 :(得分:0)

我认为这个错误是由于缺少cash_payment函数中的参数,请检查此函数的所有字段。 cash_payment($ _ POST [&#39; service_select&#39;],$ _POST [&#39; time&#39;],$ newaptdate,$ _POST [&#39; fname&#39;],$ _POST [&#39; ; aptemail&#39;],$ _POST [&#39; aptphone&#39;],$ _POST [&#39; aptmessage&#39;],$ _POST [&#39; aptugs&#39;],$ _POST [& #39; aptlawnarea&#39;],$ _POST [&#39; random&#39;]);             } 请尝试回显所有字段并检查是否找到任何空值。