所以,我有這個提交我的形式添加需要到陣列的信息按鈕運行PHP代碼,但是,當我打開這個網頁,它程序自動添加信息到我的數據庫(我使用wordpress插件ACF與擴展轉發器)。按當HTML提交按鈕,而包括信息添加
我必須做什麼,是,而不是打開網頁時運行我的PHP腳本,當我按下提交按鈕,包括在表單中添加的數只運行它。
$timea = date(d);
if($timea<27)
{
?>
<form action="<?php the_permalink(); ?>" method="GET" enctype="multipart/form-data">
<input type="number" name="cantpag" value="9">
<input type="number" name="cantreinv" value="9">
<input type="submit">
</form>
<?php
$arrayname = get_field('datos_especificos',$current_inv);
$arrayname[] = array(
'fecha' => 20140504,
'saldo' => 5,
'inversion_en_el_periodo' => 5,
'interes_causado_en_el_periodo' => 5,
'cantidad_pagada' => $_POST["cantpag"],
'cantidad_reinvertida' => $_POST["cantreinv"],
'saldo_final' => 5
);
$field_key = "datos_especificos";
update_field($field_key, $arrayname, $current_inv);
?>
<?php
}else{
?> <p>Cant do any changes after the 26th</p> <?php
}
WORKS:d,我試圖befor原因相同的,但沒有工作我用在方法GET和POST之後,改變兩張貼,由於<3 – 2014-09-26 16:11:59