douqudi5282 2018-12-04 12:35
浏览 35

将php变量传递到“特定”CF7输入的最有效方法是什么?

Scenario - I'm trying to create a simple ticketing system for use with CF7 and flamingo. I want to be able to archive email's on the server and in my mail client under the same unique identifier in the subject field.

I think I'm pretty close but I'm not strong with php, and I don't want to cause myself problems down the line. I think this qualifies as a GET request but at the same time I may be overthinking it.

(Googling this subject has turned out to be quite confusing, So I figured it best to ask someone more experienced.)

The question

How would I 'best' pass a string to a specific Contact From 7 input?

The field in question - [text* ticket-number id:ticket-field]

The following is located in my functions.php file;

/* Prevent sending step for specific form */
add_action("wpcf7_before_send_mail", "wpcf7_fill_ticket");  

function wpcf7_fill_ticket($cf7) {

    /* find id="ticket-field" */


    /* Generate CF7 Ticket Number */
    $length = 8;
    $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters)-1)];
    }
    return $string;

    /* Pass generated string into input */

}

Any help I could get with this issue would be greatly appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示