表单提交后，变量不会更改

the problem is that my variable \$target_time doesn't work well.

if (isset(\$_POST['bid'])) {
\$stmt10->execute(array(
'user_id' => \$usid,
'bid' => \$_SESSION['bid']
));
}

\$target_time = strtotime('+15 minutes', strtotime(\$stmt14));
\$current_time = time();

echo \$current_time . ' >= ' . \$target_time;

\$seconds_left = \$target_time - \$current_time;
\$minutes_left = floor(\$seconds_left / 60);
\$seconds_left -= \$minutes_left * 60;
\$seconds_left = floor(\$seconds_left);

if (\$current_time >= \$target_time) {
\$stmt9->execute();
\$r1 = \$stmt9->fetch(PDO::FETCH_ASSOC);
\$stmt12->execute();
\$r2 = \$stmt12->fetch(PDO::FETCH_ASSOC);
\$stmt11->execute(array(
'win' => \$r1['bid'],
'user_id' => \$r2['user_id']
));
\$stmt13->execute();  // Clears bid table
}

When user press a submit button, the element value, which name is bid is executing by if (isset(\$_POST['bid'])) { but the \$target_time isn't more than \$current_time and it just simply executing 1470996804 >= 900 instead of adding 15 minutes to the form submitting date. Because it gives the result of 1470996804 >= 900, which in the if (\$current_time >= \$target_time) { condition is true, it is executing immediately after submiting the form and \$stmt13->execute(); is executed, so it removes all table content. What should I do to make when the form is submitted, \$target_time would be taken from the database and the if (\$current_time >= \$target_time) { condition wouldn't be true immediately but executed only after 15 minutes when the submit button was pressed?

• 写回答
• 好问题 提建议
• 追加酬金
• 关注问题
• 收藏
• 邀请回答
{"ft_lang_label":"__label__en","ft_lang_prob":0.7435658,"math_prob":0.9606156,"size":1519,"snap":"2022-05-2022-21","text_gpt3_token_len":398,"char_repetition_ratio":0.16435644,"word_repetition_ratio":0.033816423,"special_character_ratio":0.33838052,"punctuation_ratio":0.14767933,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97138244,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-25T17:04:23Z\",\"WARC-Record-ID\":\"<urn:uuid:702aa313-ce5e-4c20-9ebc-4337869a9733>\",\"Content-Length\":\"123782\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0cab5050-3520-40ed-9bd2-1097a4845950>\",\"WARC-Concurrent-To\":\"<urn:uuid:5967ca7d-2a9e-4473-813b-b99eec23959f>\",\"WARC-IP-Address\":\"47.95.50.136\",\"WARC-Target-URI\":\"https://ask.csdn.net/questions/915677\",\"WARC-Payload-Digest\":\"sha1:RYO7FTJZ2NRFKIVKRTN2F2H3FOEUOTZO\",\"WARC-Block-Digest\":\"sha1:3SKVVYWHC5WXO7VHQWUVYKXD2W7M2VRV\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320304859.70_warc_CC-MAIN-20220125160159-20220125190159-00172.warc.gz\"}"}